diff --git a/.gitignore b/.gitignore
index fa7c75e95..347b021bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@
vendor/*
composer.phar
*~$
-*log.*
+*\.log.*
**/*.egg-info/*
**/build/*
**/dist/*
diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 1f4c66ba2..a4537b4c4 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -14,8 +14,7 @@ if (!isset($configRun) || !$configRun) {
require_once 'autoload.php';
require_once CONFIG_PATH . "constants.php";
-require_once 'Preference.php';
-require_once 'Locale.php';
+/* Common */
require_once "DateHelper.php";
require_once "LocaleHelper.php";
require_once "FileDataHelper.php";
@@ -28,13 +27,28 @@ require_once "SecurityHelper.php";
require_once "SessionHelper.php";
require_once "GoogleAnalytics.php";
require_once "Timezone.php";
-require_once "Auth.php";
-require_once "interface/OAuth2.php";
+require_once "CeleryManager.php";
require_once "TaskManager.php";
+require_once "PodcastManager.php";
require_once "UsabilityHints.php";
require_once __DIR__.'/models/formatters/LengthFormatter.php';
-require_once __DIR__.'/services/CeleryService.php';
-require_once __DIR__.'/services/SoundcloudService.php';
+require_once __DIR__.'/common/widgets/Table.php';
+/* Models */
+require_once "Auth.php";
+require_once 'Preference.php';
+require_once 'Locale.php';
+/* Enums */
+require_once "Enum.php";
+require_once "MediaType.php";
+require_once "HttpRequestType.php";
+/* Interfaces */
+require_once "OAuth2.php";
+require_once "OAuth2Controller.php";
+require_once "Publish.php";
+/* Factories */
+require_once __DIR__.'/services/CeleryServiceFactory.php';
+require_once __DIR__.'/services/PublishServiceFactory.php';
+
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
require_once __DIR__.'/forms/helpers/CustomDecorators.php';
require_once __DIR__.'/controllers/plugins/PageLayoutInitPlugin.php';
@@ -56,8 +70,6 @@ if (array_key_exists("REQUEST_URI", $_SERVER) && (stripos($_SERVER["REQUEST_URI"
}
Zend_Session::setOptions(array('strict' => true));
-
-
Config::setAirtimeVersion();
require_once (CONFIG_PATH . 'navigation.php');
@@ -68,9 +80,6 @@ $front->registerPlugin(new RabbitMqPlugin());
$front->registerPlugin(new Zend_Controller_Plugin_ConversionTracking());
$front->throwExceptions(false);
-
-
-
/* The bootstrap class should only be used to initialize actions that return a view.
Actions that return JSON will not use the bootstrap class! */
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
@@ -82,20 +91,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->doctype('XHTML1_STRICT');
}
-
- protected function _initTasks() {
- /* We need to wrap this here so that we aren't checking when we're running the unit test suite
- */
- if (getenv("AIRTIME_UNIT_TEST") != 1) {
- $taskManager = TaskManager::getInstance();
- $taskManager->runTask(AirtimeTask::UPGRADE); // Run the upgrade on each request (if it needs to be run)
- //This will do the upgrade too if it's needed...
- $taskManager->runTasks();
- }
- }
-
-
-
protected function _initZFDebug()
{
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/Billing.php b/airtime_mvc/application/common/Billing.php
index 2dbfafa9a..7b4905905 100644
--- a/airtime_mvc/application/common/Billing.php
+++ b/airtime_mvc/application/common/Billing.php
@@ -126,7 +126,8 @@ class Billing
}
else
{
- if ($product["status"] === "Active") {
+ if ($product["status"] === "Active" ||
+ $product["status"] === "Suspended") {
$airtimeProduct = $product;
$subdomain = '';
@@ -374,4 +375,13 @@ class Billing
return 0;
}
}
+
+ public static function isStationPodcastAllowed() {
+ $planLevel = Application_Model_Preference::GetPlanLevel();
+ if ($planLevel == "hobbyist") {
+ return false;
+ } else {
+ return true;
+ }
+ }
}
diff --git a/airtime_mvc/application/services/CeleryService.php b/airtime_mvc/application/common/CeleryManager.php
similarity index 89%
rename from airtime_mvc/application/services/CeleryService.php
rename to airtime_mvc/application/common/CeleryManager.php
index 8e9091290..2f27dd3d4 100644
--- a/airtime_mvc/application/services/CeleryService.php
+++ b/airtime_mvc/application/common/CeleryManager.php
@@ -1,13 +1,11 @@
getAsyncResultMessage($task->getDbName(), $task->getDbTaskId());
- // If the message isn't ready yet (Celery hasn't finished the task),
- // only throw an exception if the message has timed out.
+ // If the message isn't ready yet (Celery hasn't finished the task), throw an exception.
if ($message == FALSE) {
- if (self::_checkMessageTimeout($task)) {
+ if (static::_checkMessageTimeout($task)) {
// If the task times out, mark it as failed. We don't want to remove the
// track reference here in case it was a deletion that failed, for example.
$task->setDbStatus(CELERY_FAILED_STATUS)->save();
@@ -104,9 +106,9 @@ class CeleryService {
*
* @return bool true if there are any pending tasks, otherwise false
*/
- public static function isBrokerTaskQueueEmpty($taskName="", $serviceName = "") {
- $pendingTasks = self::_getPendingTasks($taskName, $serviceName);
- return empty($pendingTasks);
+ public static function isBrokerTaskQueueEmpty($taskName = "", $serviceName = "") {
+ self::$_pendingTasks = static::_getPendingTasks($taskName, $serviceName);
+ return empty(self::$_pendingTasks);
}
/**
@@ -120,11 +122,12 @@ class CeleryService {
* @param string $serviceName the name of the service to poll for
*/
public static function pollBrokerTaskQueue($taskName = "", $serviceName = "") {
- $pendingTasks = self::_getPendingTasks($taskName, $serviceName);
+ $pendingTasks = empty(self::$_pendingTasks) ? static::_getPendingTasks($taskName, $serviceName)
+ : self::$_pendingTasks;
foreach ($pendingTasks as $task) {
try {
- $message = self::_getTaskMessage($task);
- self::_processTaskMessage($task, $message);
+ $message = static::_getTaskMessage($task);
+ static::_processTaskMessage($task, $message);
} catch (CeleryTimeoutException $e) {
Logging::warn($e->getMessage());
} catch (Exception $e) {
@@ -183,12 +186,7 @@ class CeleryService {
protected static function _processTaskMessage($task, $message) {
$ref = $task->getThirdPartyTrackReferences(); // ThirdPartyTrackReferences join
$service = CeleryServiceFactory::getService($ref->getDbService());
- if ($message->status == CELERY_SUCCESS_STATUS
- && $task->getDbName() == $service->getCeleryDeleteTaskName()) {
- $service->removeTrackReference($ref->getDbFileId());
- } else {
- $service->updateTrackReference($ref->getDbId(), json_decode($message->result), $message->status);
- }
+ $service->updateTrackReference($task, $ref->getDbId(), json_decode($message->result), $message->status);
}
/**
diff --git a/airtime_mvc/application/common/FileDataHelper.php b/airtime_mvc/application/common/FileDataHelper.php
index 568b25d4d..6ad391dbc 100644
--- a/airtime_mvc/application/common/FileDataHelper.php
+++ b/airtime_mvc/application/common/FileDataHelper.php
@@ -14,6 +14,7 @@ class FileDataHelper {
"audio/aac" => "aac",
"audio/aacp" => "aac",
"audio/mp4" => "m4a",
+ "video/mp4" => "mp4",
"audio/x-flac" => "flac",
"audio/wav" => "wav",
"audio/x-wav" => "wav",
diff --git a/airtime_mvc/application/common/HTTPHelper.php b/airtime_mvc/application/common/HTTPHelper.php
index c702da480..8d6c05106 100644
--- a/airtime_mvc/application/common/HTTPHelper.php
+++ b/airtime_mvc/application/common/HTTPHelper.php
@@ -18,7 +18,14 @@ class Application_Common_HTTPHelper
);
}
- public static function getStationUrl()
+ /**
+ * Construct the base station URL
+ *
+ * @param boolean $secured whether or not to use HTTPS
+ *
+ * @return string the station URL
+ */
+ public static function getStationUrl($secured = true)
{
$CC_CONFIG = Config::getConfig();
$baseUrl = $CC_CONFIG['baseUrl'];
@@ -32,12 +39,17 @@ class Application_Common_HTTPHelper
}
$scheme = "http";
- if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
+ if ($secured && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
$scheme = "https";
$basePort = "443"; //Airtime Pro compatibility hack
}
- $stationUrl = "$scheme://${baseUrl}:${basePort}${baseDir}";
+ $portStr = "";
+ if (!(($scheme == "http" && $basePort == "80")
+ || ($scheme == "https" && $basePort == "443"))) {
+ $portStr = ":${basePort}";
+ }
+ $stationUrl = "$scheme://${baseUrl}${portStr}${baseDir}";
return $stationUrl;
}
diff --git a/airtime_mvc/application/common/LocaleHelper.php b/airtime_mvc/application/common/LocaleHelper.php
index 96ac1f28b..8b1ff12ec 100644
--- a/airtime_mvc/application/common/LocaleHelper.php
+++ b/airtime_mvc/application/common/LocaleHelper.php
@@ -5,3 +5,160 @@
function _pro($str) {
return dgettext("pro", $str);
}
+
+class Application_Common_LocaleHelper {
+
+ /**
+ * Return an array of all ISO 639-1 language codes and their corresponding translated language names
+ *
+ * @return array the array of language codes to names
+ */
+ public static function getISO6391LanguageCodes() {
+ /**
+ * From: http://www.binarytides.com/php-array-of-iso-639-1-language-codes-and-names/
+ *
+ * ISO 639-1 Language Codes
+ * References :
+ * 1. http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
+ * 2. http://blog.xoundboy.com/?p=235
+ */
+ return array(
+ 'en' => _('English'),
+ 'aa' => _('Afar'),
+ 'ab' => _('Abkhazian'),
+ 'af' => _('Afrikaans'),
+ 'am' => _('Amharic'),
+ 'ar' => _('Arabic'),
+ 'as' => _('Assamese'),
+ 'ay' => _('Aymara'),
+ 'az' => _('Azerbaijani'),
+ 'ba' => _('Bashkir'),
+ 'be' => _('Belarusian'),
+ 'bg' => _('Bulgarian'),
+ 'bh' => _('Bihari'),
+ 'bi' => _('Bislama'),
+ 'bn' => _('Bengali/Bangla'),
+ 'bo' => _('Tibetan'),
+ 'br' => _('Breton'),
+ 'ca' => _('Catalan'),
+ 'co' => _('Corsican'),
+ 'cs' => _('Czech'),
+ 'cy' => _('Welsh'),
+ 'da' => _('Danish'),
+ 'de' => _('German'),
+ 'dz' => _('Bhutani'),
+ 'el' => _('Greek'),
+ 'eo' => _('Esperanto'),
+ 'es' => _('Spanish'),
+ 'et' => _('Estonian'),
+ 'eu' => _('Basque'),
+ 'fa' => _('Persian'),
+ 'fi' => _('Finnish'),
+ 'fj' => _('Fiji'),
+ 'fo' => _('Faeroese'),
+ 'fr' => _('French'),
+ 'fy' => _('Frisian'),
+ 'ga' => _('Irish'),
+ 'gd' => _('Scots/Gaelic'),
+ 'gl' => _('Galician'),
+ 'gn' => _('Guarani'),
+ 'gu' => _('Gujarati'),
+ 'ha' => _('Hausa'),
+ 'hi' => _('Hindi'),
+ 'hr' => _('Croatian'),
+ 'hu' => _('Hungarian'),
+ 'hy' => _('Armenian'),
+ 'ia' => _('Interlingua'),
+ 'ie' => _('Interlingue'),
+ 'ik' => _('Inupiak'),
+ 'in' => _('Indonesian'),
+ 'is' => _('Icelandic'),
+ 'it' => _('Italian'),
+ 'iw' => _('Hebrew'),
+ 'ja' => _('Japanese'),
+ 'ji' => _('Yiddish'),
+ 'jw' => _('Javanese'),
+ 'ka' => _('Georgian'),
+ 'kk' => _('Kazakh'),
+ 'kl' => _('Greenlandic'),
+ 'km' => _('Cambodian'),
+ 'kn' => _('Kannada'),
+ 'ko' => _('Korean'),
+ 'ks' => _('Kashmiri'),
+ 'ku' => _('Kurdish'),
+ 'ky' => _('Kirghiz'),
+ 'la' => _('Latin'),
+ 'ln' => _('Lingala'),
+ 'lo' => _('Laothian'),
+ 'lt' => _('Lithuanian'),
+ 'lv' => _('Latvian/Lettish'),
+ 'mg' => _('Malagasy'),
+ 'mi' => _('Maori'),
+ 'mk' => _('Macedonian'),
+ 'ml' => _('Malayalam'),
+ 'mn' => _('Mongolian'),
+ 'mo' => _('Moldavian'),
+ 'mr' => _('Marathi'),
+ 'ms' => _('Malay'),
+ 'mt' => _('Maltese'),
+ 'my' => _('Burmese'),
+ 'na' => _('Nauru'),
+ 'ne' => _('Nepali'),
+ 'nl' => _('Dutch'),
+ 'no' => _('Norwegian'),
+ 'oc' => _('Occitan'),
+ 'om' => _('(Afan)/Oromoor/Oriya'),
+ 'pa' => _('Punjabi'),
+ 'pl' => _('Polish'),
+ 'ps' => _('Pashto/Pushto'),
+ 'pt' => _('Portuguese'),
+ 'qu' => _('Quechua'),
+ 'rm' => _('Rhaeto-Romance'),
+ 'rn' => _('Kirundi'),
+ 'ro' => _('Romanian'),
+ 'ru' => _('Russian'),
+ 'rw' => _('Kinyarwanda'),
+ 'sa' => _('Sanskrit'),
+ 'sd' => _('Sindhi'),
+ 'sg' => _('Sangro'),
+ 'sh' => _('Serbo-Croatian'),
+ 'si' => _('Singhalese'),
+ 'sk' => _('Slovak'),
+ 'sl' => _('Slovenian'),
+ 'sm' => _('Samoan'),
+ 'sn' => _('Shona'),
+ 'so' => _('Somali'),
+ 'sq' => _('Albanian'),
+ 'sr' => _('Serbian'),
+ 'ss' => _('Siswati'),
+ 'st' => _('Sesotho'),
+ 'su' => _('Sundanese'),
+ 'sv' => _('Swedish'),
+ 'sw' => _('Swahili'),
+ 'ta' => _('Tamil'),
+ 'te' => _('Tegulu'),
+ 'tg' => _('Tajik'),
+ 'th' => _('Thai'),
+ 'ti' => _('Tigrinya'),
+ 'tk' => _('Turkmen'),
+ 'tl' => _('Tagalog'),
+ 'tn' => _('Setswana'),
+ 'to' => _('Tonga'),
+ 'tr' => _('Turkish'),
+ 'ts' => _('Tsonga'),
+ 'tt' => _('Tatar'),
+ 'tw' => _('Twi'),
+ 'uk' => _('Ukrainian'),
+ 'ur' => _('Urdu'),
+ 'uz' => _('Uzbek'),
+ 'vi' => _('Vietnamese'),
+ 'vo' => _('Volapuk'),
+ 'wo' => _('Wolof'),
+ 'xh' => _('Xhosa'),
+ 'yo' => _('Yoruba'),
+ 'zh' => _('Chinese'),
+ 'zu' => _('Zulu'),
+ );
+ }
+
+}
diff --git a/airtime_mvc/application/common/PodcastManager.php b/airtime_mvc/application/common/PodcastManager.php
new file mode 100644
index 000000000..026e5e605
--- /dev/null
+++ b/airtime_mvc/application/common/PodcastManager.php
@@ -0,0 +1,104 @@
+ $lastPolled + self::$_PODCAST_POLL_INTERVAL_SECONDS);
+ }
+
+ /**
+ * Find all podcasts flagged for automatic ingest whose most recent episode has
+ * yet to be downloaded and download it with Celery
+ *
+ * @throws InvalidPodcastException
+ * @throws PodcastNotFoundException
+ */
+ public static function downloadNewestEpisodes() {
+ $autoIngestPodcasts = static::_getAutoIngestPodcasts();
+ $service = new Application_Service_PodcastEpisodeService();
+ foreach ($autoIngestPodcasts as $podcast) {
+ $episodes = static::_findUningestedEpisodes($podcast, $service);
+ // Since episodes don't have to be uploaded with a time (H:i:s) component,
+ // store the timestamp of the most recent (first pushed to the array) episode
+ // that we're ingesting.
+ // Note that this folds to the failure case (Celery task timeout/download failure)
+ // but will at least continue to ingest new episodes.
+ if (!empty($episodes)) {
+ $podcast->setDbAutoIngestTimestamp(gmdate('r', strtotime($episodes[0]->getDbPublicationDate())))->save();
+ $service->downloadEpisodes($episodes);
+ }
+ }
+
+ Application_Model_Preference::setPodcastPollLock(microtime(true));
+ }
+
+ /**
+ * Given an ImportedPodcast, find all uningested episodes since the last automatic ingest,
+ * and add them to a given episodes array
+ *
+ * @param ImportedPodcast $podcast the podcast to search
+ * @param Application_Service_PodcastEpisodeService $service podcast episode service object
+ *
+ * @return array array of episodes to append be downloaded
+ */
+ protected static function _findUningestedEpisodes($podcast, $service) {
+ $episodeList = $service->getPodcastEpisodes($podcast->getDbPodcastId());
+ $episodes = array();
+ usort($episodeList, array(static::class, "_sortByEpisodePubDate"));
+ for ($i = 0; $i < sizeof($episodeList); $i++) {
+ $episodeData = $episodeList[$i];
+ $ts = $podcast->getDbAutoIngestTimestamp();
+ // If the timestamp for this podcast is empty (no previous episodes have been ingested) and there are no
+ // episodes in the list of episodes to ingest, don't skip this episode - we should try to ingest the
+ // most recent episode when the user first sets the podcast to automatic ingest.
+ // If the publication date of this episode is before the ingest timestamp, we don't need to ingest it
+ if ((empty($ts) && ($i > 0)) || strtotime($episodeData["pub_date"]) < strtotime($ts)) {
+ continue;
+ }
+ $episode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episodeData["guid"]);
+ // Make sure there's no existing episode placeholder or import, and that the data is non-empty
+ if (empty($episode) && !empty($episodeData)) {
+ $placeholder = $service->addPlaceholder($podcast->getDbPodcastId(), $episodeData);
+ array_push($episodes, $placeholder);
+ }
+ }
+ return $episodes;
+ }
+
+ /**
+ * Find all podcasts flagged for automatic ingest
+ *
+ * @return PropelObjectCollection collection of ImportedPodcast objects
+ * flagged for automatic ingest
+ */
+ protected static function _getAutoIngestPodcasts() {
+ return ImportedPodcastQuery::create()
+ ->filterByDbAutoIngest(true)
+ ->find();
+ }
+
+ /**
+ * Custom sort function for podcast episodes
+ *
+ * @param array $a first episode array to compare
+ * @param array $b second episode array to compare
+ * @return bool boolean for ordering
+ */
+ protected static function _sortByEpisodePubDate($a, $b) {
+ if ($a["pub_date"] == $b["pub_date"]) return 0;
+ return (strtotime($a["pub_date"]) < strtotime($b["pub_date"])) ? 1 : -1; // Descending order
+ }
+
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/common/TaskManager.php b/airtime_mvc/application/common/TaskManager.php
index c44be2552..d8ab9c10d 100644
--- a/airtime_mvc/application/common/TaskManager.php
+++ b/airtime_mvc/application/common/TaskManager.php
@@ -3,8 +3,8 @@
/**
* Class TaskManager
*
- * When adding a new task, the new AirtimeTask class will need to be added to the internal task list,
- * as an ENUM value to the AirtimeTask interface, and as a case in the TaskFactory.
+ * When adding a new task, the new AirtimeTask class will also need to be added
+ * as a class constant and to the array in TaskFactory
*/
final class TaskManager {
@@ -12,10 +12,7 @@ final class TaskManager {
* @var array tasks to be run. Maps task names to a boolean value denoting
* whether the task has been checked/run
*/
- protected $_taskList = [
- AirtimeTask::UPGRADE => false,
- AirtimeTask::CELERY => false,
- ];
+ protected $_taskList;
/**
* @var TaskManager singleton instance object
@@ -28,6 +25,7 @@ final class TaskManager {
const TASK_INTERVAL_SECONDS = 30;
/**
+ *
* @var $con PDO Propel connection object
*/
private $_con;
@@ -36,6 +34,9 @@ final class TaskManager {
* Private constructor so class is uninstantiable
*/
private function __construct() {
+ foreach (array_keys(TaskFactory::$tasks) as $v) {
+ $this->_taskList[$v] = false;
+ }
}
/**
@@ -77,7 +78,7 @@ final class TaskManager {
*/
public function runTasks() {
// If there is data in auth storage, this could be a user request
- // so we should lock the TaskManager to avoid blocking
+ // so we should just return to avoid blocking
if ($this->_isUserSessionRequest()) {
return;
}
@@ -85,7 +86,7 @@ final class TaskManager {
$this->_con->beginTransaction();
try {
$lock = $this->_getLock();
- if ($lock && microtime(true) < $lock['valstr'] + self::TASK_INTERVAL_SECONDS) {
+ if ($lock && (microtime(true) < ($lock['valstr'] + self::TASK_INTERVAL_SECONDS))) {
// Propel caches the database connection and uses it persistently, so if we don't
// use commit() here, we end up blocking other queries made within this request
$this->_con->commit();
@@ -96,8 +97,7 @@ final class TaskManager {
} catch (Exception $e) {
// We get here if there are simultaneous requests trying to fetch the lock row
$this->_con->rollBack();
- // Logging::info($e->getMessage()); // We actually get here a lot, so it's
- // better to be silent here to avoid log bloat
+ Logging::warn($e->getMessage());
return;
}
foreach ($this->_taskList as $task => $hasTaskRun) {
@@ -153,18 +153,10 @@ final class TaskManager {
}
/**
- * Interface AirtimeTask Interface for task operations - also acts as task type ENUM
+ * Interface AirtimeTask Interface for task operations
*/
interface AirtimeTask {
- /**
- * PHP doesn't have ENUMs so declare them as interface constants
- * Task types - values don't really matter as long as they're unique
- */
-
- const UPGRADE = "upgrade";
- const CELERY = "celery";
-
/**
* Check whether the task should be run
*
@@ -181,33 +173,10 @@ interface AirtimeTask {
}
-/**
- * Class TaskFactory Factory class to abstract task instantiation
- */
-class TaskFactory {
-
- /**
- * Get an AirtimeTask based on a task type
- *
- * @param $task string the task type; uses AirtimeTask constants as an ENUM
- *
- * @return AirtimeTask|null return a task of the given type or null if no corresponding
- * task exists or is implemented
- */
- public static function getTask($task) {
- switch($task) {
- case AirtimeTask::UPGRADE:
- return new UpgradeTask();
- case AirtimeTask::CELERY:
- return new CeleryTask();
- }
- return null;
- }
-
-}
-
/**
* Class UpgradeTask
+ *
+ * Checks the current Airtime version and runs any outstanding upgrades
*/
class UpgradeTask implements AirtimeTask {
@@ -231,6 +200,8 @@ class UpgradeTask implements AirtimeTask {
/**
* Class CeleryTask
+ *
+ * Checks the Celery broker task queue and runs callbacks for completed tasks
*/
class CeleryTask implements AirtimeTask {
@@ -240,14 +211,137 @@ class CeleryTask implements AirtimeTask {
* @return bool true if there are pending tasks in ThirdPartyTrackReferences
*/
public function shouldBeRun() {
- return !CeleryService::isBrokerTaskQueueEmpty();
+ return !CeleryManager::isBrokerTaskQueueEmpty();
}
/**
* Poll the task queue for any completed Celery tasks
*/
public function run() {
- CeleryService::pollBrokerTaskQueue();
+ CeleryManager::pollBrokerTaskQueue();
}
-}
\ No newline at end of file
+}
+
+/**
+ * Class PodcastTask
+ *
+ * Checks podcasts marked for automatic ingest and downloads any new episodes
+ * since the task was last run
+ */
+class PodcastTask implements AirtimeTask {
+
+ /**
+ * Check whether or not the podcast polling interval has passed
+ *
+ * @return bool true if the podcast polling interval has passed
+ */
+ public function shouldBeRun() {
+ $overQuota = Application_Model_Systemstatus::isDiskOverQuota();
+ return !$overQuota && PodcastManager::hasPodcastPollIntervalPassed();
+ }
+
+ /**
+ * Download the latest episode for all podcasts flagged for automatic ingest
+ */
+ public function run() {
+ PodcastManager::downloadNewestEpisodes();
+ }
+
+}
+
+/**
+ * Class ImportTask
+ */
+class ImportCleanupTask implements AirtimeTask {
+
+ /**
+ * Check if there are any files that have been stuck
+ * in Pending status for over an hour
+ *
+ * @return bool true if there are any files stuck pending,
+ * otherwise false
+ */
+ public function shouldBeRun() {
+ return Application_Service_MediaService::areFilesStuckInPending();
+ }
+
+ /**
+ * Clean up stuck imports by changing their import status to Failed
+ */
+ public function run() {
+ Application_Service_MediaService::clearStuckPendingImports();
+ }
+
+}
+
+/**
+ * Class StationPodcastTask
+ *
+ * Checks the Station podcast rollover timer and resets monthly allotted
+ * downloads if enough time has passed (default: 1 month)
+ */
+class StationPodcastTask implements AirtimeTask {
+
+ const STATION_PODCAST_RESET_TIMER_SECONDS = 2.628e+6; // 1 month XXX: should we use datetime roll for this instead?
+
+ /**
+ * Check whether or not the download counter for the station podcast should be reset
+ *
+ * @return bool true if enough time has passed
+ */
+ public function shouldBeRun() {
+ $lastReset = Application_Model_Preference::getStationPodcastDownloadResetTimer();
+ return empty($lastReset) || (microtime(true) > ($lastReset + self::STATION_PODCAST_RESET_TIMER_SECONDS));
+ }
+
+ /**
+ * Reset the station podcast download counter
+ */
+ public function run() {
+ Application_Model_Preference::resetStationPodcastDownloadCounter();
+ Application_Model_Preference::setStationPodcastDownloadResetTimer(microtime(true));
+ }
+
+}
+
+/**
+ * Class TaskFactory Factory class to abstract task instantiation
+ */
+class TaskFactory {
+
+ /**
+ * PHP doesn't have ENUMs so declare them as constants
+ * Task types - values don't really matter as long as they're unique
+ */
+
+ const UPGRADE = "upgrade";
+ const CELERY = "celery";
+ const PODCAST = "podcast";
+ const IMPORT = "import";
+ const STATION_PODCAST = "station-podcast";
+
+ /**
+ * @var array map of arbitrary identifiers to class names to be instantiated reflectively
+ */
+ public static $tasks = array(
+ "upgrade" => "UpgradeTask",
+ "celery" => "CeleryTask",
+ "podcast" => "PodcastTask",
+ "import" => "ImportCleanupTask",
+ "station-podcast" => "StationPodcastTask",
+ );
+
+ /**
+ * Get an AirtimeTask based on a task type
+ *
+ * @param $task string the task type; uses AirtimeTask constants as an ENUM
+ *
+ * @return AirtimeTask|null return a task of the given type or null if no corresponding
+ * task exists or is implemented
+ */
+ public static function getTask($task) {
+ return new self::$tasks[$task]();
+ }
+
+}
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/HttpRequestType.php b/airtime_mvc/application/common/enum/HttpRequestType.php
new file mode 100644
index 000000000..59b1a25b3
--- /dev/null
+++ b/airtime_mvc/application/common/enum/HttpRequestType.php
@@ -0,0 +1,12 @@
+appendFile($baseUrl . $deps[$i] .'?'. $airtimeVersion, 'text/javascript');
+ }
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php
index 843cfff30..52ba6fa7b 100644
--- a/airtime_mvc/application/configs/ACL.php
+++ b/airtime_mvc/application/configs/ACL.php
@@ -35,13 +35,18 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('downgrade'))
->add(new Zend_Acl_Resource('rest:media'))
->add(new Zend_Acl_Resource('rest:show-image'))
+ ->add(new Zend_Acl_Resource('rest:podcast'))
+ ->add(new Zend_Acl_Resource('rest:podcast-episodes'))
+ ->add(new Zend_Acl_Resource('podcast'))
->add(new Zend_Acl_Resource('billing'))
->add(new Zend_Acl_Resource('thank-you'))
->add(new Zend_Acl_Resource('provisioning'))
->add(new Zend_Acl_Resource('player'))
+ ->add(new Zend_Acl_Resource('render'))
->add(new Zend_Acl_Resource('soundcloud'))
->add(new Zend_Acl_Resource('embeddablewidgets'))
- ->add(new Zend_Acl_Resource('setup'));
+ ->add(new Zend_Acl_Resource('setup'))
+ ->add(new Zend_Acl_Resource('feeds'));
/** Creating permissions */
$ccAcl->allow('G', 'index')
@@ -50,6 +55,7 @@ $ccAcl->allow('G', 'index')
->allow('G', 'error')
->allow('G', 'user', 'edit-user')
->allow('G', 'showbuilder')
+ ->allow('G', 'render')
->allow('G', 'api')
->allow('G', 'schedule')
->allow('G', 'dashboard')
@@ -61,11 +67,17 @@ $ccAcl->allow('G', 'index')
->allow('G', 'downgrade')
->allow('G', 'rest:show-image', 'get')
->allow('G', 'rest:media', 'get')
+ ->allow('G', 'rest:podcast', 'get')
+ ->allow('G', 'rest:podcast-episodes', 'get')
->allow('G', 'setup')
->allow('G', 'embeddablewidgets')
+ ->allow('G', 'feeds')
->allow('H', 'soundcloud')
->allow('H', 'rest:show-image')
->allow('H', 'rest:media')
+ ->allow('H', 'rest:podcast')
+ ->allow('H', 'rest:podcast-episodes')
+ ->allow('H', 'podcast')
->allow('H', 'preference', 'is-import-in-progress')
->allow('H', 'usersettings')
->allow('H', 'plupload')
diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php
index 671726a17..4eb58b161 100644
--- a/airtime_mvc/application/configs/classmap-airtime-conf.php
+++ b/airtime_mvc/application/configs/classmap-airtime-conf.php
@@ -106,6 +106,18 @@ return array (
'BaseCloudFile' => 'airtime/om/BaseCloudFile.php',
'BaseCloudFilePeer' => 'airtime/om/BaseCloudFilePeer.php',
'BaseCloudFileQuery' => 'airtime/om/BaseCloudFileQuery.php',
+ 'BaseImportedPodcast' => 'airtime/om/BaseImportedPodcast.php',
+ 'BaseImportedPodcastPeer' => 'airtime/om/BaseImportedPodcastPeer.php',
+ 'BaseImportedPodcastQuery' => 'airtime/om/BaseImportedPodcastQuery.php',
+ 'BasePodcast' => 'airtime/om/BasePodcast.php',
+ 'BasePodcastEpisodes' => 'airtime/om/BasePodcastEpisodes.php',
+ 'BasePodcastEpisodesPeer' => 'airtime/om/BasePodcastEpisodesPeer.php',
+ 'BasePodcastEpisodesQuery' => 'airtime/om/BasePodcastEpisodesQuery.php',
+ 'BasePodcastPeer' => 'airtime/om/BasePodcastPeer.php',
+ 'BasePodcastQuery' => 'airtime/om/BasePodcastQuery.php',
+ 'BaseStationPodcast' => 'airtime/om/BaseStationPodcast.php',
+ 'BaseStationPodcastPeer' => 'airtime/om/BaseStationPodcastPeer.php',
+ 'BaseStationPodcastQuery' => 'airtime/om/BaseStationPodcastQuery.php',
'BaseThirdPartyTrackReferences' => 'airtime/om/BaseThirdPartyTrackReferences.php',
'BaseThirdPartyTrackReferencesPeer' => 'airtime/om/BaseThirdPartyTrackReferencesPeer.php',
'BaseThirdPartyTrackReferencesQuery' => 'airtime/om/BaseThirdPartyTrackReferencesQuery.php',
@@ -249,6 +261,22 @@ return array (
'CloudFilePeer' => 'airtime/CloudFilePeer.php',
'CloudFileQuery' => 'airtime/CloudFileQuery.php',
'CloudFileTableMap' => 'airtime/map/CloudFileTableMap.php',
+ 'ImportedPodcast' => 'airtime/ImportedPodcast.php',
+ 'ImportedPodcastPeer' => 'airtime/ImportedPodcastPeer.php',
+ 'ImportedPodcastQuery' => 'airtime/ImportedPodcastQuery.php',
+ 'ImportedPodcastTableMap' => 'airtime/map/ImportedPodcastTableMap.php',
+ 'Podcast' => 'airtime/Podcast.php',
+ 'PodcastEpisodes' => 'airtime/PodcastEpisodes.php',
+ 'PodcastEpisodesPeer' => 'airtime/PodcastEpisodesPeer.php',
+ 'PodcastEpisodesQuery' => 'airtime/PodcastEpisodesQuery.php',
+ 'PodcastEpisodesTableMap' => 'airtime/map/PodcastEpisodesTableMap.php',
+ 'PodcastPeer' => 'airtime/PodcastPeer.php',
+ 'PodcastQuery' => 'airtime/PodcastQuery.php',
+ 'PodcastTableMap' => 'airtime/map/PodcastTableMap.php',
+ 'StationPodcast' => 'airtime/StationPodcast.php',
+ 'StationPodcastPeer' => 'airtime/StationPodcastPeer.php',
+ 'StationPodcastQuery' => 'airtime/StationPodcastQuery.php',
+ 'StationPodcastTableMap' => 'airtime/map/StationPodcastTableMap.php',
'ThirdPartyTrackReferences' => 'airtime/ThirdPartyTrackReferences.php',
'ThirdPartyTrackReferencesPeer' => 'airtime/ThirdPartyTrackReferencesPeer.php',
'ThirdPartyTrackReferencesQuery' => 'airtime/ThirdPartyTrackReferencesQuery.php',
diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php
index 6de09147e..bfad8759e 100644
--- a/airtime_mvc/application/configs/constants.php
+++ b/airtime_mvc/application/configs/constants.php
@@ -32,7 +32,7 @@ define('AIRTIME_COPYRIGHT_DATE' , '2010-2015');
define('AIRTIME_REST_VERSION' , '1.1');
define('AIRTIME_API_VERSION' , '1.1');
// XXX: it's important that we upgrade this every time we add an upgrade!
-define('AIRTIME_CODE_VERSION' , '2.5.14');
+define('AIRTIME_CODE_VERSION' , '2.5.16');
// Defaults
define('DEFAULT_LOGO_PLACEHOLDER', 1);
@@ -42,6 +42,7 @@ define('DEFAULT_MICROTIME_FORMAT', 'Y-m-d H:i:s.u');
define('DEFAULT_ICECAST_PORT', 8000);
define('DEFAULT_ICECAST_PASS', 'hackme');
define('DEFAULT_SHOW_COLOR', '76aca5');
+define('DEFAULT_INTERVAL_FORMAT', 'H:i:s.u');
// Metadata Keys for files
define('MDATA_KEY_FILEPATH' , 'filepath');
@@ -124,3 +125,13 @@ define('CELERY_FAILED_STATUS', 'FAILED');
// Celery Services
define('SOUNDCLOUD_SERVICE_NAME', 'soundcloud');
+define('PODCAST_SERVICE_NAME', 'podcast');
+
+// Publish Services
+define('STATION_PODCAST_SERVICE_NAME', 'station_podcast');
+
+// Podcast Types
+//define('STATION_PODCAST', 0);
+//define('IMPORTED_PODCAST', 1);
+
+define('ITUNES_XML_NAMESPACE_URL', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php
index aba3630e3..2a12003f7 100644
--- a/airtime_mvc/application/configs/navigation.php
+++ b/airtime_mvc/application/configs/navigation.php
@@ -8,6 +8,13 @@
* the navigation container below.
*/
$pages = array(
+ array(
+ 'label' => ""._('My Podcast'),
+ 'module' => 'default',
+ 'controller' => 'podcast',
+ 'action' => 'station',
+ 'resource' => 'podcast'
+ ),
array(
'label' => ""._('Radio Page'),
'uri' => '/',
diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php
index ed278a775..de7c7f156 100644
--- a/airtime_mvc/application/controllers/ApiController.php
+++ b/airtime_mvc/application/controllers/ApiController.php
@@ -23,7 +23,6 @@ class ApiController extends Zend_Controller_Action
"shows",
"show-tracks",
"show-schedules",
- "station-logo",
"show-logo",
"stream-m3u"
);
@@ -73,6 +72,8 @@ class ApiController extends Zend_Controller_Action
->addActionContext('update-replay-gain-value' , 'json')
->addActionContext('update-cue-values-by-silan' , 'json')
->addActionContext('get-usability-hint' , 'json')
+ ->addActionContext('poll-celery' , 'json')
+ ->addActionContext('recalculate-schedule' , 'json') //RKTN-260
->initContext();
}
@@ -100,6 +101,14 @@ class ApiController extends Zend_Controller_Action
exit();
}
+ public function pollCeleryAction() {
+ $this->view->layout()->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+
+ $taskManager = TaskManager::getInstance();
+ $taskManager->runTask(TaskFactory::CELERY);
+ }
+
public function versionAction()
{
$this->_helper->json->sendJson( array(
@@ -527,13 +536,13 @@ class ApiController extends Zend_Controller_Action
$mime_type = finfo_buffer($f, $blob, FILEINFO_MIME_TYPE);
finfo_close($f);
- header("Content-type: " . $mime_type);
+ header("Content-Type: " . $mime_type);
echo $blob;
} else {
header('HTTP/1.0 401 Unauthorized');
- print _('You are not allowed to access this resource. ');
+ print _('You are not allowed to access this resource.');
exit;
- }
+ }
}
public function scheduleAction()
@@ -1516,9 +1525,40 @@ class ApiController extends Zend_Controller_Action
$streamData = Application_Model_StreamSetting::getEnabledStreamData();
foreach ($streamData as $stream) {
- $m3uFile .= "#EXTINF,".$stationName." - " . strtoupper($stream['codec']) . "\r\n";
+ $m3uFile .= "#EXTINF," . $stationName . " - " . strtoupper($stream['codec']) . "\r\n";
$m3uFile .= $stream['url'] . "\r\n\r\n";
}
echo $m3uFile;
}
+
+ public function recalculateScheduleAction()
+ {
+ $this->view->layout()->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+
+ Zend_Session::start();
+
+ $scheduler = new Application_Model_Scheduler();
+ session_write_close();
+
+ $now = new DateTime("now", new DateTimeZone("UTC"));
+
+ $showInstances = CcShowInstancesQuery::create()
+ ->filterByDbStarts($now, Criteria::GREATER_THAN)
+ //->filterByDbModifiedInstance(false)
+ ->orderByDbStarts()
+ ->find();
+ //->find($this->con);
+ $total = $showInstances->count();
+ $progress = 0;
+ foreach ($showInstances as $instance) {
+ echo(round(floatval($progress / $total)*100) . "% - " . $instance->getDbId() . "\n
");
+ flush();
+ ob_flush();
+ //while(@ob_end_clean());
+ $scheduler->removeGaps2($instance->getDbId());
+ $progress += 1;
+ }
+ echo("Recalculated $total shows.");
+ }
}
diff --git a/airtime_mvc/application/controllers/BillingController.php b/airtime_mvc/application/controllers/BillingController.php
index bf508036b..bf4aafb1d 100644
--- a/airtime_mvc/application/controllers/BillingController.php
+++ b/airtime_mvc/application/controllers/BillingController.php
@@ -21,6 +21,12 @@ class BillingController extends Zend_Controller_Action {
public function upgradeAction()
{
+ //If you're not on a trial and you're suspended, we don't let you access the plans page and redirect you to the invoices
+ //page to force you to pay your bills first.
+ $isTrial = (Application_Model_Preference::GetPlanLevel() == 'trial');
+ if (!$isTrial && (Application_Model_Preference::getProvisioningStatus() == PROVISIONING_STATUS_SUSPENDED)) {
+ $this->_redirect('billing/invoices');
+ }
Zend_Layout::getMvcInstance()->assign('parent_page', 'Billing');
diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php
index 660a6b61c..3e403f818 100644
--- a/airtime_mvc/application/controllers/DashboardController.php
+++ b/airtime_mvc/application/controllers/DashboardController.php
@@ -1,5 +1,7 @@
_helper->layout->setLayout('livestream');
$logo = Application_Model_Preference::GetStationLogo();
- if ($logo === DEFAULT_LOGO_PLACEHOLDER) {
- $this->view->logo = "/".DEFAULT_LOGO_FILE;
- } else {
- $this->view->logo = "data:image/png;base64,".$logo;
- }
+ $this->view->logo = "data:image/png;base64,".$logo;
}
public function helpAction()
@@ -117,4 +115,17 @@ class DashboardController extends Zend_Controller_Action
$this->view->airtime_version = Application_Model_Preference::GetAirtimeVersion();
}
+ public function tableTestAction()
+ {
+ Zend_Layout::getMvcInstance()->assign('parent_page', 'Help');
+
+ $CC_CONFIG = Config::getConfig();
+
+ $baseUrl = Application_Common_OsPath::getBaseDir();
+
+ $headScript = $this->view->headScript();
+ AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
+ $this->view->headScript()->appendFile($baseUrl.'js/airtime/widgets/table-example.js?'.$CC_CONFIG['airtime_version']);
+
+ }
}
diff --git a/airtime_mvc/application/controllers/EmbedController.php b/airtime_mvc/application/controllers/EmbedController.php
index f191c1f1d..37e4c5b01 100644
--- a/airtime_mvc/application/controllers/EmbedController.php
+++ b/airtime_mvc/application/controllers/EmbedController.php
@@ -55,6 +55,10 @@ class EmbedController extends Zend_Controller_Action
array_push($availableDesktopStreams, $s);
}
}
+ } else if ($stream == "file") {
+ $this->view->playerMode = "file";
+ $this->view->streamURL = json_encode($request->getParam("file_url"));
+ $this->view->codec = $request->getParam("file_codec");
} elseif (!empty($stream)) {
$this->view->playerMode = "manual";
$selectedStreamData = $streamData[$stream];
diff --git a/airtime_mvc/application/controllers/FeedsController.php b/airtime_mvc/application/controllers/FeedsController.php
new file mode 100644
index 000000000..4bca8d7d2
--- /dev/null
+++ b/airtime_mvc/application/controllers/FeedsController.php
@@ -0,0 +1,59 @@
+view->layout()->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+
+ if ((Application_Model_Preference::getStationPodcastPrivacy()
+ && $this->getRequest()->getParam("sharing_token") != Application_Model_Preference::getStationPodcastDownloadKey())
+ && !RestAuth::verifyAuth(true, true, $this)) {
+ $this->getResponse()
+ ->setHttpResponseCode(401);
+ return;
+ }
+
+
+ $rssData = Application_Service_PodcastService::createStationRssFeed();
+
+ $mimeType = "text/xml";
+ header("Content-Type: $mimeType; charset=UTF-8");
+
+ if (isset($_SERVER['HTTP_RANGE'])) {
+ header('HTTP/1.1 206 Partial Content');
+ } else {
+ header('HTTP/1.1 200 OK');
+ }
+ header("Content-Type: $mimeType");
+ header("Content-Transfer-Encoding: binary");
+ header('Cache-Control: public, must-revalidate, max-age=0');
+ header('Pragma: no-cache');
+ header('Accept-Ranges: bytes');
+ $size = strlen($rssData);
+
+ $begin = 0;
+ $end = $size - 1;
+
+ //ob_start(); //Must start a buffer here for these header() functions
+
+ if (isset($_SERVER['HTTP_RANGE'])) {
+ if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) {
+ $begin = intval($matches[1]);
+ if (!empty($matches[2])) {
+ $end = intval($matches[2]);
+ }
+ }
+ }
+
+ if ($size > 0) {
+ header('Content-Length:' . (($end - $begin) + 1));
+ if (isset($_SERVER['HTTP_RANGE'])) {
+ header("Content-Range: bytes $begin-$end/$size");
+ }
+ }
+
+ echo $rssData;
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/controllers/IndexController.php b/airtime_mvc/application/controllers/IndexController.php
index d0070ca18..8a04b85ca 100644
--- a/airtime_mvc/application/controllers/IndexController.php
+++ b/airtime_mvc/application/controllers/IndexController.php
@@ -13,14 +13,24 @@ class IndexController extends Zend_Controller_Action
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headTitle(Application_Model_Preference::GetHeadTitle());
- $this->view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
- ->appendFile($baseUrl . 'js/i18n/jquery.i18n.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
- ->appendFile($baseUrl . 'locale/general-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript')
- ->appendScript("$.i18n.setDictionary(general_dict)")
- ->appendScript("var baseUrl='$baseUrl'");
+ $this->view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
+
+ $this->view->headScript()->appendFile($baseUrl . 'js/i18n/jquery.i18n.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl . 'locale/general-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript');
+ $this->view->headScript()->appendScript("$.i18n.setDictionary(general_dict)");
+ $this->view->headScript()->appendScript("var baseUrl='$baseUrl'");
+
+ //jplayer
+ $this->view->headScript()->appendFile($baseUrl.'js/jplayer/jquery.jplayer.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->setStylesheet($baseUrl.'css/radio-page/radio-page.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/embed/weekly-schedule-widget.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/radio-page/station-podcast.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/bootstrap.css?'.$CC_CONFIG['airtime_version']);
+
+ //jplayer control buttons
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']);
$this->_helper->layout->setLayout('radio-page');
@@ -40,6 +50,40 @@ class IndexController extends Zend_Controller_Action
}
$this->view->displayLoginButton = $displayRadioPageLoginButtonValue;
+ //station feed episodes
+ $stationPodcastId = Application_Model_Preference::getStationPodcastId();
+ $podcastEpisodesService = new Application_Service_PodcastEpisodeService();
+ $episodes = $podcastEpisodesService->getPodcastEpisodes($stationPodcastId, 0, 0, PodcastEpisodesPeer::PUBLICATION_DATE, "DESC");
+ foreach ($episodes as $e => $v) {
+ $episodes[$e]["CcFiles"]["track_title"] = htmlspecialchars($v["CcFiles"]["track_title"], ENT_QUOTES);
+ $episodes[$e]["CcFiles"]["artist_name"] = htmlspecialchars($v["CcFiles"]["artist_name"], ENT_QUOTES);
+
+ $pubDate = explode(" ", $v["publication_date"]);
+ $episodes[$e]["publication_date"] = $pubDate[0];
+
+ $length = explode(".", $v["CcFiles"]["length"]);
+ $episodes[$e]["CcFiles"]["length"] = $length[0];
+
+ $episodes[$e]["mime"] = FileDataHelper::getAudioMimeTypeArray()[$v["CcFiles"]["mime"]];
+
+ if (is_null($v["CcFiles"]["description"])) {
+ $episodes[$e]["CcFiles"]["description"] = "";
+ }
+ }
+
+ $episodePages = array_chunk($episodes, 10);
+
+ $this->view->episodes = json_encode($episodePages, JSON_FORCE_OBJECT);
+ $this->view->displayRssTab = (!Application_Model_Preference::getStationPodcastPrivacy());
+
+ $stationPodcast = PodcastQuery::create()->findOneByDbId($stationPodcastId);
+ $url = $stationPodcast->getDbUrl();
+ $this->view->stationPodcastRssUrl = $url;
+
+ $stationName = Application_Model_Preference::GetStationName();
+ $this->view->podcastTitle = sprintf(_("%s Podcast"), !empty($stationName) ? $stationName : $CC_CONFIG["stationId"]);
+ $this->view->emptyPodcastMessage = _("No tracks have been published yet.");
+
}
public function mainAction()
diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php
index 878da2f5f..221271d81 100644
--- a/airtime_mvc/application/controllers/LibraryController.php
+++ b/airtime_mvc/application/controllers/LibraryController.php
@@ -18,6 +18,7 @@ class LibraryController extends Zend_Controller_Action
->addActionContext('get-file-metadata', 'html')
->addActionContext('set-num-entries', 'json')
->addActionContext('edit-file-md', 'json')
+ ->addActionContext('publish-dialog', 'html')
->initContext();
}
@@ -120,7 +121,8 @@ class LibraryController extends Zend_Controller_Action
}
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete");
- $menu["edit"] = array("name"=> _("Edit Metadata"), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
+ $menu["edit"] = array("name"=> _("Edit..."), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
+ $menu["publish"] = array("name"=> _("Publish..."), "icon" => "soundcloud", "url" => $baseUrl."library/publish/id/{$id}");
}
// It's important that we always return the parent id (cc_files id)
@@ -133,33 +135,21 @@ class LibraryController extends Zend_Controller_Action
// SOUNDCLOUD MENU OPTION
$ownerId = empty($obj) ? $file->getFileOwnerId() : $obj->getCreatorId();
if ($isAdminOrPM || $ownerId == $user->getId()) {
- $soundcloudService = new SoundcloudService();
+ $soundcloudService = new Application_Service_SoundcloudService();
if ($type === "audioclip" && $soundcloudService->hasAccessToken()) {
-
- //create a menu separator
- $menu["sep1"] = "-----------";
-
- //create a sub menu for Soundcloud actions.
- $menu["soundcloud"] = array("name" => _(SOUNDCLOUD), "icon" => "soundcloud", "items" => array());
-
$serviceId = $soundcloudService->getServiceId($id);
if (!is_null($file) && $serviceId != 0) {
+ $trackRef = ThirdPartyTrackReferencesQuery::create()
+ ->filterByDbService(SOUNDCLOUD_SERVICE_NAME)
+ ->findOneByDbFileId($id);
+
+ //create a menu separator
+ $menu["sep1"] = "-----------";
+
+ //create a sub menu for Soundcloud actions.
+ $menu["soundcloud"] = array("name" => _(SOUNDCLOUD), "icon" => "soundcloud", "items" => array());
$menu["soundcloud"]["items"]["view"] = array("name" => _("View track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/view-on-sound-cloud/id/{$id}");
- $menu["soundcloud"]["items"]["remove"] = array("name" => _("Remove track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/delete/id/{$id}");
- } else {
- // If a reference exists for this file ID, that means the user has uploaded the track
- // but we haven't yet gotten a response from Celery, so disable the menu item
- if ($soundcloudService->referenceExists($id)) {
- $menu["soundcloud"]["items"]["upload"] = array(
- "name" => _("Upload track"), "icon" => "soundcloud",
- "url" => $baseUrl . "soundcloud/upload/id/{$id}", "disabled" => true
- );
- } else {
- $menu["soundcloud"]["items"]["upload"] = array(
- "name" => _("Upload track"), "icon" => "soundcloud",
- "url" => $baseUrl . "soundcloud/upload/id/{$id}"
- );
- }
+ $menu["soundcloud"]["items"]["update"] = array("name" => _("Update track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/update/id/{$trackRef->getDbForeignId()}");
}
}
}
@@ -181,7 +171,7 @@ class LibraryController extends Zend_Controller_Action
if ($obj_sess->id !== $id && $screen == "playlist") {
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
- $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit");
+ $menu["edit"] = array("name"=> _("Edit..."), "icon" => "edit");
}
}
@@ -203,7 +193,7 @@ class LibraryController extends Zend_Controller_Action
}
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($screen == "playlist") {
- $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
+ $menu["edit"] = array("name"=> _("Edit..."), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
}
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete");
}
@@ -379,7 +369,6 @@ class LibraryController extends Zend_Controller_Action
$this->view->form = $form;
$this->view->id = $file_id;
$this->view->title = $file->getPropelOrm()->getDbTrackTitle();
- $this->view->type = "md";
$this->view->html = $this->view->render('library/edit-file-md.phtml');
}
@@ -453,4 +442,16 @@ class LibraryController extends Zend_Controller_Action
Logging::info($e->getMessage());
}
}
+
+ public function publishDialogAction() {
+ $this->_helper->layout->disableLayout();
+
+
+ if (!Billing::isStationPodcastAllowed()) {
+ $this->renderScript("podcast/featureupgrade-pane.phtml");
+ }
+
+
+ //This just spits out publish-dialog.phtml!
+ }
}
diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php
index d957de10a..99ac81f9b 100644
--- a/airtime_mvc/application/controllers/LocaleController.php
+++ b/airtime_mvc/application/controllers/LocaleController.php
@@ -28,6 +28,7 @@ class LocaleController extends Zend_Controller_Action
$translations = array (
//common/common.js
"Audio Player" => _("Audio Player"),
+ "Something went wrong!" => _("Something went wrong!"),
//dashboard/dashboard.js
"Recording:" => _("Recording:"),
"Master Stream" => _("Master Stream"),
@@ -57,6 +58,7 @@ class LocaleController extends Zend_Controller_Action
"You haven't added any webstreams" => _("You haven't added any webstreams"),
"Learn about tracks" => _("Learn about tracks"),
"Learn about playlists" => _("Learn about playlists"),
+ "Learn about podcasts" => _("Learn about podcasts"),
"Learn about smart blocks" => _("Learn about smart blocks"),
"Learn about webstreams" => _("Learn about webstreams"),
"Click 'New' to create one." => _("Click 'New' to create one."),
@@ -108,6 +110,10 @@ class LocaleController extends Zend_Controller_Action
"Are you sure you want to delete the selected item?" => _("Are you sure you want to delete the selected item?"),
"Uploading in progress..." => _("Uploading in progress..."),
"Retrieving data from the server..." => _("Retrieving data from the server..."),
+ // SOUNDCLOUD
+ "Are you sure? SoundCloud stats and comments for this track will be permanently removed." => "Are you sure? SoundCloud stats and comments for this track will be permanently removed.",
+ "Your track is being deleted from SoundCloud" => "Your track is being deleted from SoundCloud",
+ "Your track is being uploaded and will appear on SoundCloud in a couple of minutes" => "Your track is being uploaded and will appear on SoundCloud in a couple of minutes",
"The soundcloud id for this file is: " => _("The soundcloud id for this file is: "),
"There was an error while uploading to soundcloud." => _("There was an error while uploading to soundcloud."),
"Error code: " => _("Error code: "),
@@ -116,6 +122,7 @@ class LocaleController extends Zend_Controller_Action
"Input must be a number" => _("Input must be a number"),
"Input must be in the format: yyyy-mm-dd" => _("Input must be in the format: yyyy-mm-dd"),
"Input must be in the format: hh:mm:ss.t" => _("Input must be in the format: hh:mm:ss.t"),
+ "My Podcast" => _("My Podcast"),
//library/plupload.js
"You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"
=> _("You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"),
diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php
index c1fa52d17..543b2870b 100644
--- a/airtime_mvc/application/controllers/PlaylistController.php
+++ b/airtime_mvc/application/controllers/PlaylistController.php
@@ -102,7 +102,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->form = $form;
$this->view->obj = $obj;
- $this->view->type = "sb";
+ //$this->view->type = "sb";
$this->view->id = $obj->getId();
if ($isJson) {
@@ -112,7 +112,7 @@ class PlaylistController extends Zend_Controller_Action
}
} else {
$this->view->obj = $obj;
- $this->view->type = "pl";
+ //$this->view->type = "pl";
$this->view->id = $obj->getId();
if ($isJson) {
return $this->view->html = $this->view->render($viewPath);
@@ -217,7 +217,6 @@ class PlaylistController extends Zend_Controller_Action
$id = $this->_getParam('id', null);
$type = $this->_getParam('type');
$objInfo = Application_Model_Library::getObjInfo($type);
- Logging::info("editing {$type} {$id}");
// if (!is_null($id)) {
Application_Model_Library::changePlaylist($id, $type);
@@ -573,7 +572,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->result = 1;
}
$this->view->name = $bl->getName();
- $this->view->type = "sb";
+ //$this->view->type = "sb";
$this->view->id = $bl->getId();
$this->view->modified = $bl->getLastModified("U");
} else if ($params['type'] == 'playlist') {
diff --git a/airtime_mvc/application/controllers/PodcastController.php b/airtime_mvc/application/controllers/PodcastController.php
new file mode 100644
index 000000000..6c1fd05c3
--- /dev/null
+++ b/airtime_mvc/application/controllers/PodcastController.php
@@ -0,0 +1,41 @@
+view->headScript();
+ AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
+
+ $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+
+ $this->view->headScript()->appendFile($baseUrl.'js/airtime/widgets/table.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/podcast.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
+
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']);
+
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/station_podcast.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'css/dashboard.css?'.$CC_CONFIG['airtime_version']);
+ }
+
+ /**
+ * Renders the Station podcast view
+ */
+ public function stationAction() {
+
+ if (!Billing::isStationPodcastAllowed()) {
+ $this->render("featureupgrade-page");
+ return;
+ }
+
+ $stationPodcastId = Application_Model_Preference::getStationPodcastId();
+ $podcast = Application_Service_PodcastService::getPodcastById($stationPodcastId);
+ $this->view->podcast = json_encode($podcast);
+ $this->view->form = new Application_Form_StationPodcast();
+ }
+
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php
index 683f86dce..5d00bd1a8 100644
--- a/airtime_mvc/application/controllers/PreferenceController.php
+++ b/airtime_mvc/application/controllers/PreferenceController.php
@@ -66,8 +66,10 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::setTuneinPartnerId($values["tunein_partner_id"]);
// SoundCloud Preferences
- Application_Model_Preference::setDefaultSoundCloudLicenseType($values["SoundCloudLicense"]);
- Application_Model_Preference::setDefaultSoundCloudSharingType($values["SoundCloudSharing"]);
+ if (Billing::isStationPodcastAllowed()) {
+ Application_Model_Preference::setDefaultSoundCloudLicenseType($values["SoundCloudLicense"]);
+ Application_Model_Preference::setDefaultSoundCloudSharingType($values["SoundCloudSharing"]);
+ }
$this->view->statusMsg = "
+ * $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 PodcastEpisodes object
+ *
+ * @param PodcastEpisodes|PropelObjectCollection $podcastEpisodes 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 filterByPodcastEpisodes($podcastEpisodes, $comparison = null)
+ {
+ if ($podcastEpisodes instanceof PodcastEpisodes) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $podcastEpisodes->getDbFileId(), $comparison);
+ } elseif ($podcastEpisodes instanceof PropelObjectCollection) {
+ return $this
+ ->usePodcastEpisodesQuery()
+ ->filterByPrimaryKeys($podcastEpisodes->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByPodcastEpisodes() only accepts arguments of type PodcastEpisodes or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the PodcastEpisodes 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 joinPodcastEpisodes($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('PodcastEpisodes');
+
+ // 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, 'PodcastEpisodes');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the PodcastEpisodes relation PodcastEpisodes 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 PodcastEpisodesQuery A secondary query class using the current class as primary query
+ */
+ public function usePodcastEpisodesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinPodcastEpisodes($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'PodcastEpisodes', 'PodcastEpisodesQuery');
+ }
+
/**
* 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/BaseImportedPodcast.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php
new file mode 100644
index 000000000..1b72d0cef
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php
@@ -0,0 +1,1132 @@
+auto_ingest = false;
+ }
+
+ /**
+ * Initializes internal state of BaseImportedPodcast 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 [auto_ingest] column value.
+ *
+ * @return boolean
+ */
+ public function getDbAutoIngest()
+ {
+
+ return $this->auto_ingest;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [auto_ingest_timestamp] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is null, then the raw DateTime object will be returned.
+ * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getDbAutoIngestTimestamp($format = 'Y-m-d H:i:s')
+ {
+ if ($this->auto_ingest_timestamp === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->auto_ingest_timestamp);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->auto_ingest_timestamp, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [podcast_id] column value.
+ *
+ * @return int
+ */
+ public function getDbPodcastId()
+ {
+
+ return $this->podcast_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return ImportedPodcast 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[] = ImportedPodcastPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * 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 ImportedPodcast 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[] = ImportedPodcastPeer::AUTO_INGEST;
+ }
+
+
+ return $this;
+ } // setDbAutoIngest()
+
+ /**
+ * Sets the value of [auto_ingest_timestamp] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return ImportedPodcast The current object (for fluent API support)
+ */
+ public function setDbAutoIngestTimestamp($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->auto_ingest_timestamp !== null || $dt !== null) {
+ $currentDateAsString = ($this->auto_ingest_timestamp !== null && $tmpDt = new DateTime($this->auto_ingest_timestamp)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->auto_ingest_timestamp = $newDateAsString;
+ $this->modifiedColumns[] = ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbAutoIngestTimestamp()
+
+ /**
+ * Set the value of [podcast_id] column.
+ *
+ * @param int $v new value
+ * @return ImportedPodcast 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[] = ImportedPodcastPeer::PODCAST_ID;
+ }
+
+ if ($this->aPodcast !== null && $this->aPodcast->getDbId() !== $v) {
+ $this->aPodcast = null;
+ }
+
+
+ return $this;
+ } // setDbPodcastId()
+
+ /**
+ * 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->auto_ingest = ($row[$startcol + 1] !== null) ? (boolean) $row[$startcol + 1] : null;
+ $this->auto_ingest_timestamp = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->podcast_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating ImportedPodcast 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->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(ImportedPodcastPeer::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 = ImportedPodcastPeer::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->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(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ImportedPodcastQuery::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(ImportedPodcastPeer::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);
+ ImportedPodcastPeer::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->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[] = ImportedPodcastPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ImportedPodcastPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('imported_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(ImportedPodcastPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) {
+ $modifiedColumns[':p' . $index++] = '"auto_ingest"';
+ }
+ if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) {
+ $modifiedColumns[':p' . $index++] = '"auto_ingest_timestamp"';
+ }
+ if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) {
+ $modifiedColumns[':p' . $index++] = '"podcast_id"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "imported_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 '"auto_ingest"':
+ $stmt->bindValue($identifier, $this->auto_ingest, PDO::PARAM_BOOL);
+ break;
+ case '"auto_ingest_timestamp"':
+ $stmt->bindValue($identifier, $this->auto_ingest_timestamp, PDO::PARAM_STR);
+ break;
+ case '"podcast_id"':
+ $stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ }
+
+ $this->validationFailures = $res;
+
+ return false;
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggregated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aPodcast !== null) {
+ if (!$this->aPodcast->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aPodcast->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ImportedPodcastPeer::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 = ImportedPodcastPeer::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->getDbAutoIngest();
+ break;
+ case 2:
+ return $this->getDbAutoIngestTimestamp();
+ break;
+ case 3:
+ return $this->getDbPodcastId();
+ 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['ImportedPodcast'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ImportedPodcast'][$this->getPrimaryKey()] = true;
+ $keys = ImportedPodcastPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbAutoIngest(),
+ $keys[2] => $this->getDbAutoIngestTimestamp(),
+ $keys[3] => $this->getDbPodcastId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ 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 = ImportedPodcastPeer::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->setDbAutoIngest($value);
+ break;
+ case 2:
+ $this->setDbAutoIngestTimestamp($value);
+ break;
+ case 3:
+ $this->setDbPodcastId($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 = ImportedPodcastPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbAutoIngest($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbAutoIngestTimestamp($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbPodcastId($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(ImportedPodcastPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ImportedPodcastPeer::ID)) $criteria->add(ImportedPodcastPeer::ID, $this->id);
+ if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST, $this->auto_ingest);
+ if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $this->auto_ingest_timestamp);
+ if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) $criteria->add(ImportedPodcastPeer::PODCAST_ID, $this->podcast_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME);
+ $criteria->add(ImportedPodcastPeer::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 ImportedPodcast (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->setDbAutoIngest($this->getDbAutoIngest());
+ $copyObj->setDbAutoIngestTimestamp($this->getDbAutoIngestTimestamp());
+ $copyObj->setDbPodcastId($this->getDbPodcastId());
+
+ 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 ImportedPodcast 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 ImportedPodcastPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ImportedPodcastPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Podcast object.
+ *
+ * @param Podcast $v
+ * @return ImportedPodcast 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->addImportedPodcast($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->addImportedPodcasts($this);
+ */
+ }
+
+ return $this->aPodcast;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->auto_ingest = null;
+ $this->auto_ingest_timestamp = null;
+ $this->podcast_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aPodcast instanceof Persistent) {
+ $this->aPodcast->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aPodcast = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ImportedPodcastPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+
+ // delegate behavior
+
+ if (is_callable(array('Podcast', $name))) {
+ if (!$delegate = $this->getPodcast()) {
+ $delegate = new Podcast();
+ $this->setPodcast($delegate);
+ }
+
+ return call_user_func_array(array($delegate, $name), $params);
+ }
+
+ return parent::__call($name, $params);
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php
new file mode 100644
index 000000000..70aa4080f
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php
@@ -0,0 +1,1009 @@
+ array ('DbId', 'DbAutoIngest', 'DbAutoIngestTimestamp', 'DbPodcastId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbAutoIngestTimestamp', 'dbPodcastId', ),
+ BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, ImportedPodcastPeer::PODCAST_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'AUTO_INGEST', 'AUTO_INGEST_TIMESTAMP', 'PODCAST_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'auto_ingest_timestamp', 'podcast_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ImportedPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbAutoIngest' => 1, 'DbAutoIngestTimestamp' => 2, 'DbPodcastId' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbAutoIngest' => 1, 'dbAutoIngestTimestamp' => 2, 'dbPodcastId' => 3, ),
+ BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP => 2, ImportedPodcastPeer::PODCAST_ID => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'AUTO_INGEST' => 1, 'AUTO_INGEST_TIMESTAMP' => 2, 'PODCAST_ID' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'auto_ingest' => 1, 'auto_ingest_timestamp' => 2, 'podcast_id' => 3, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ImportedPodcastPeer::getFieldNames($toType);
+ $key = isset(ImportedPodcastPeer::$fieldKeys[$fromType][$name]) ? ImportedPodcastPeer::$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(ImportedPodcastPeer::$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, ImportedPodcastPeer::$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 ImportedPodcastPeer::$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. ImportedPodcastPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ImportedPodcastPeer::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(ImportedPodcastPeer::ID);
+ $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST);
+ $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP);
+ $criteria->addSelectColumn(ImportedPodcastPeer::PODCAST_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.auto_ingest');
+ $criteria->addSelectColumn($alias . '.auto_ingest_timestamp');
+ $criteria->addSelectColumn($alias . '.podcast_id');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ImportedPodcastPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImportedPodcastPeer::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 ImportedPodcast
+ * @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 = ImportedPodcastPeer::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 ImportedPodcastPeer::populateObjects(ImportedPodcastPeer::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(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ImportedPodcastPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ImportedPodcastPeer::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 ImportedPodcast $obj A ImportedPodcast 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
+ ImportedPodcastPeer::$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 ImportedPodcast 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 ImportedPodcast) {
+ $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 ImportedPodcast object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ImportedPodcastPeer::$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 ImportedPodcast 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(ImportedPodcastPeer::$instances[$key])) {
+ return ImportedPodcastPeer::$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 (ImportedPodcastPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ ImportedPodcastPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to imported_podcast
+ * 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 = ImportedPodcastPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ImportedPodcastPeer::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;
+ ImportedPodcastPeer::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 (ImportedPodcast object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ImportedPodcastPeer::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 + ImportedPodcastPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ImportedPodcastPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ImportedPodcastPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * 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(ImportedPodcastPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ImportedPodcastPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ImportedPodcastPeer::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 ImportedPodcast 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 ImportedPodcast 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(ImportedPodcastPeer::DATABASE_NAME);
+ }
+
+ ImportedPodcastPeer::addSelectColumns($criteria);
+ $startcol = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS;
+ PodcastPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ImportedPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ImportedPodcastPeer::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 = ImportedPodcastPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ImportedPodcastPeer::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 (ImportedPodcast) to $obj2 (Podcast)
+ $obj2->addImportedPodcast($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(ImportedPodcastPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ImportedPodcastPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ImportedPodcastPeer::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 ImportedPodcast 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 ImportedPodcast 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(ImportedPodcastPeer::DATABASE_NAME);
+ }
+
+ ImportedPodcastPeer::addSelectColumns($criteria);
+ $startcol2 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS;
+
+ PodcastPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ImportedPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ImportedPodcastPeer::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 = ImportedPodcastPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ImportedPodcastPeer::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 loaded
+
+ // Add the $obj1 (ImportedPodcast) to the collection in $obj2 (Podcast)
+ $obj2->addImportedPodcast($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(ImportedPodcastPeer::DATABASE_NAME)->getTable(ImportedPodcastPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseImportedPodcastPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseImportedPodcastPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \ImportedPodcastTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return ImportedPodcastPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ImportedPodcast or Criteria object.
+ *
+ * @param mixed $values Criteria or ImportedPodcast 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(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ImportedPodcast object
+ }
+
+ if ($criteria->containsKey(ImportedPodcastPeer::ID) && $criteria->keyContainsValue(ImportedPodcastPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportedPodcastPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ImportedPodcastPeer::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 ImportedPodcast or Criteria object.
+ *
+ * @param mixed $values Criteria or ImportedPodcast 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(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ImportedPodcastPeer::ID);
+ $value = $criteria->remove(ImportedPodcastPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ImportedPodcastPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ImportedPodcast object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the imported_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(ImportedPodcastPeer::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(ImportedPodcastPeer::TABLE_NAME, $con, ImportedPodcastPeer::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).
+ ImportedPodcastPeer::clearInstancePool();
+ ImportedPodcastPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ImportedPodcast or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ImportedPodcast 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(ImportedPodcastPeer::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.
+ ImportedPodcastPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ImportedPodcast) { // it's a model object
+ // invalidate the cache for this single object
+ ImportedPodcastPeer::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(ImportedPodcastPeer::DATABASE_NAME);
+ $criteria->add(ImportedPodcastPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ ImportedPodcastPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ImportedPodcastPeer::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);
+ ImportedPodcastPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ImportedPodcast 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 ImportedPodcast $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(ImportedPodcastPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ImportedPodcastPeer::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(ImportedPodcastPeer::DATABASE_NAME, ImportedPodcastPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return ImportedPodcast
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = ImportedPodcastPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME);
+ $criteria->add(ImportedPodcastPeer::ID, $pk);
+
+ $v = ImportedPodcastPeer::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 ImportedPodcast[]
+ * @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(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME);
+ $criteria->add(ImportedPodcastPeer::ID, $pks, Criteria::IN);
+ $objs = ImportedPodcastPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
+
+} // BaseImportedPodcastPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseImportedPodcastPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php
new file mode 100644
index 000000000..fa52bc7cc
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php
@@ -0,0 +1,482 @@
+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 ImportedPodcast|ImportedPodcast[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ImportedPodcastPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ImportedPodcastPeer::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 ImportedPodcast 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 ImportedPodcast A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "auto_ingest", "auto_ingest_timestamp", "podcast_id" FROM "imported_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 ImportedPodcast();
+ $obj->hydrate($row);
+ ImportedPodcastPeer::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 ImportedPodcast|ImportedPodcast[]|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|ImportedPodcast[]|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 ImportedPodcastQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ImportedPodcastPeer::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 ImportedPodcastQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ImportedPodcastPeer::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 ImportedPodcastQuery 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(ImportedPodcastPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId, $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 ImportedPodcastQuery 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(ImportedPodcastPeer::AUTO_INGEST, $dbAutoIngest, $comparison);
+ }
+
+ /**
+ * Filter the query on the auto_ingest_timestamp column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbAutoIngestTimestamp('2011-03-14'); // WHERE auto_ingest_timestamp = '2011-03-14'
+ * $query->filterByDbAutoIngestTimestamp('now'); // WHERE auto_ingest_timestamp = '2011-03-14'
+ * $query->filterByDbAutoIngestTimestamp(array('max' => 'yesterday')); // WHERE auto_ingest_timestamp < '2011-03-13'
+ *
+ *
+ * @param mixed $dbAutoIngestTimestamp 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 ImportedPodcastQuery The current query, for fluid interface
+ */
+ public function filterByDbAutoIngestTimestamp($dbAutoIngestTimestamp = null, $comparison = null)
+ {
+ if (is_array($dbAutoIngestTimestamp)) {
+ $useMinMax = false;
+ if (isset($dbAutoIngestTimestamp['min'])) {
+ $this->addUsingAlias(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $dbAutoIngestTimestamp['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbAutoIngestTimestamp['max'])) {
+ $this->addUsingAlias(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $dbAutoIngestTimestamp['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $dbAutoIngestTimestamp, $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 ImportedPodcastQuery 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(ImportedPodcastPeer::PODCAST_ID, $dbPodcastId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPodcastId['max'])) {
+ $this->addUsingAlias(ImportedPodcastPeer::PODCAST_ID, $dbPodcastId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ImportedPodcastPeer::PODCAST_ID, $dbPodcastId, $comparison);
+ }
+
+ /**
+ * 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 ImportedPodcastQuery 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(ImportedPodcastPeer::PODCAST_ID, $podcast->getDbId(), $comparison);
+ } elseif ($podcast instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ImportedPodcastPeer::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 ImportedPodcastQuery 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 ImportedPodcast $importedPodcast Object to remove from the list of results
+ *
+ * @return ImportedPodcastQuery The current query, for fluid interface
+ */
+ public function prune($importedPodcast = null)
+ {
+ if ($importedPodcast) {
+ $this->addUsingAlias(ImportedPodcastPeer::ID, $importedPodcast->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
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..8a866b717
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BasePodcast.php
@@ -0,0 +1,2560 @@
+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 [language] column value.
+ *
+ * @return string
+ */
+ public function getDbLanguage()
+ {
+
+ return $this->language;
+ }
+
+ /**
+ * Get the [copyright] column value.
+ *
+ * @return string
+ */
+ public function getDbCopyright()
+ {
+
+ return $this->copyright;
+ }
+
+ /**
+ * Get the [link] column value.
+ *
+ * @return string
+ */
+ public function getDbLink()
+ {
+
+ return $this->link;
+ }
+
+ /**
+ * Get the [itunes_author] column value.
+ *
+ * @return string
+ */
+ public function getDbItunesAuthor()
+ {
+
+ return $this->itunes_author;
+ }
+
+ /**
+ * Get the [itunes_keywords] column value.
+ *
+ * @return string
+ */
+ public function getDbItunesKeywords()
+ {
+
+ return $this->itunes_keywords;
+ }
+
+ /**
+ * Get the [itunes_summary] column value.
+ *
+ * @return string
+ */
+ public function getDbItunesSummary()
+ {
+
+ return $this->itunes_summary;
+ }
+
+ /**
+ * Get the [itunes_subtitle] column value.
+ *
+ * @return string
+ */
+ public function getDbItunesSubtitle()
+ {
+
+ return $this->itunes_subtitle;
+ }
+
+ /**
+ * Get the [itunes_category] column value.
+ *
+ * @return string
+ */
+ public function getDbItunesCategory()
+ {
+
+ return $this->itunes_category;
+ }
+
+ /**
+ * Get the [itunes_explicit] column value.
+ *
+ * @return string
+ */
+ public function getDbItunesExplicit()
+ {
+
+ return $this->itunes_explicit;
+ }
+
+ /**
+ * 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()
+
+ /**
+ * Set the value of [language] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbLanguage($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->language !== $v) {
+ $this->language = $v;
+ $this->modifiedColumns[] = PodcastPeer::LANGUAGE;
+ }
+
+
+ return $this;
+ } // setDbLanguage()
+
+ /**
+ * Set the value of [copyright] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbCopyright($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->copyright !== $v) {
+ $this->copyright = $v;
+ $this->modifiedColumns[] = PodcastPeer::COPYRIGHT;
+ }
+
+
+ return $this;
+ } // setDbCopyright()
+
+ /**
+ * Set the value of [link] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbLink($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->link !== $v) {
+ $this->link = $v;
+ $this->modifiedColumns[] = PodcastPeer::LINK;
+ }
+
+
+ return $this;
+ } // setDbLink()
+
+ /**
+ * Set the value of [itunes_author] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbItunesAuthor($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->itunes_author !== $v) {
+ $this->itunes_author = $v;
+ $this->modifiedColumns[] = PodcastPeer::ITUNES_AUTHOR;
+ }
+
+
+ return $this;
+ } // setDbItunesAuthor()
+
+ /**
+ * Set the value of [itunes_keywords] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbItunesKeywords($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->itunes_keywords !== $v) {
+ $this->itunes_keywords = $v;
+ $this->modifiedColumns[] = PodcastPeer::ITUNES_KEYWORDS;
+ }
+
+
+ return $this;
+ } // setDbItunesKeywords()
+
+ /**
+ * Set the value of [itunes_summary] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbItunesSummary($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->itunes_summary !== $v) {
+ $this->itunes_summary = $v;
+ $this->modifiedColumns[] = PodcastPeer::ITUNES_SUMMARY;
+ }
+
+
+ return $this;
+ } // setDbItunesSummary()
+
+ /**
+ * Set the value of [itunes_subtitle] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbItunesSubtitle($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->itunes_subtitle !== $v) {
+ $this->itunes_subtitle = $v;
+ $this->modifiedColumns[] = PodcastPeer::ITUNES_SUBTITLE;
+ }
+
+
+ return $this;
+ } // setDbItunesSubtitle()
+
+ /**
+ * Set the value of [itunes_category] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbItunesCategory($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->itunes_category !== $v) {
+ $this->itunes_category = $v;
+ $this->modifiedColumns[] = PodcastPeer::ITUNES_CATEGORY;
+ }
+
+
+ return $this;
+ } // setDbItunesCategory()
+
+ /**
+ * Set the value of [itunes_explicit] column.
+ *
+ * @param string $v new value
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setDbItunesExplicit($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->itunes_explicit !== $v) {
+ $this->itunes_explicit = $v;
+ $this->modifiedColumns[] = PodcastPeer::ITUNES_EXPLICIT;
+ }
+
+
+ return $this;
+ } // setDbItunesExplicit()
+
+ /**
+ * 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()
+ {
+ // 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->language = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->copyright = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->link = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->itunes_author = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->itunes_keywords = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->itunes_summary = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->itunes_subtitle = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
+ $this->itunes_category = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
+ $this->itunes_explicit = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
+ $this->owner = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 15; // 15 = 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->collStationPodcasts = null;
+
+ $this->collImportedPodcasts = null;
+
+ $this->collPodcastEpisodess = 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->stationPodcastsScheduledForDeletion !== null) {
+ if (!$this->stationPodcastsScheduledForDeletion->isEmpty()) {
+ StationPodcastQuery::create()
+ ->filterByPrimaryKeys($this->stationPodcastsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->stationPodcastsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collStationPodcasts !== null) {
+ foreach ($this->collStationPodcasts as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->importedPodcastsScheduledForDeletion !== null) {
+ if (!$this->importedPodcastsScheduledForDeletion->isEmpty()) {
+ ImportedPodcastQuery::create()
+ ->filterByPrimaryKeys($this->importedPodcastsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->importedPodcastsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collImportedPodcasts !== null) {
+ foreach ($this->collImportedPodcasts as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->podcastEpisodessScheduledForDeletion !== null) {
+ if (!$this->podcastEpisodessScheduledForDeletion->isEmpty()) {
+ PodcastEpisodesQuery::create()
+ ->filterByPrimaryKeys($this->podcastEpisodessScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->podcastEpisodessScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collPodcastEpisodess !== null) {
+ foreach ($this->collPodcastEpisodess 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::LANGUAGE)) {
+ $modifiedColumns[':p' . $index++] = '"language"';
+ }
+ if ($this->isColumnModified(PodcastPeer::COPYRIGHT)) {
+ $modifiedColumns[':p' . $index++] = '"copyright"';
+ }
+ if ($this->isColumnModified(PodcastPeer::LINK)) {
+ $modifiedColumns[':p' . $index++] = '"link"';
+ }
+ if ($this->isColumnModified(PodcastPeer::ITUNES_AUTHOR)) {
+ $modifiedColumns[':p' . $index++] = '"itunes_author"';
+ }
+ if ($this->isColumnModified(PodcastPeer::ITUNES_KEYWORDS)) {
+ $modifiedColumns[':p' . $index++] = '"itunes_keywords"';
+ }
+ if ($this->isColumnModified(PodcastPeer::ITUNES_SUMMARY)) {
+ $modifiedColumns[':p' . $index++] = '"itunes_summary"';
+ }
+ if ($this->isColumnModified(PodcastPeer::ITUNES_SUBTITLE)) {
+ $modifiedColumns[':p' . $index++] = '"itunes_subtitle"';
+ }
+ if ($this->isColumnModified(PodcastPeer::ITUNES_CATEGORY)) {
+ $modifiedColumns[':p' . $index++] = '"itunes_category"';
+ }
+ if ($this->isColumnModified(PodcastPeer::ITUNES_EXPLICIT)) {
+ $modifiedColumns[':p' . $index++] = '"itunes_explicit"';
+ }
+ 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 '"language"':
+ $stmt->bindValue($identifier, $this->language, PDO::PARAM_STR);
+ break;
+ case '"copyright"':
+ $stmt->bindValue($identifier, $this->copyright, PDO::PARAM_STR);
+ break;
+ case '"link"':
+ $stmt->bindValue($identifier, $this->link, PDO::PARAM_STR);
+ break;
+ case '"itunes_author"':
+ $stmt->bindValue($identifier, $this->itunes_author, PDO::PARAM_STR);
+ break;
+ case '"itunes_keywords"':
+ $stmt->bindValue($identifier, $this->itunes_keywords, PDO::PARAM_STR);
+ break;
+ case '"itunes_summary"':
+ $stmt->bindValue($identifier, $this->itunes_summary, PDO::PARAM_STR);
+ break;
+ case '"itunes_subtitle"':
+ $stmt->bindValue($identifier, $this->itunes_subtitle, PDO::PARAM_STR);
+ break;
+ case '"itunes_category"':
+ $stmt->bindValue($identifier, $this->itunes_category, PDO::PARAM_STR);
+ break;
+ case '"itunes_explicit"':
+ $stmt->bindValue($identifier, $this->itunes_explicit, PDO::PARAM_STR);
+ 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->collStationPodcasts !== null) {
+ foreach ($this->collStationPodcasts as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collImportedPodcasts !== null) {
+ foreach ($this->collImportedPodcasts as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collPodcastEpisodess !== null) {
+ foreach ($this->collPodcastEpisodess 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->getDbLanguage();
+ break;
+ case 6:
+ return $this->getDbCopyright();
+ break;
+ case 7:
+ return $this->getDbLink();
+ break;
+ case 8:
+ return $this->getDbItunesAuthor();
+ break;
+ case 9:
+ return $this->getDbItunesKeywords();
+ break;
+ case 10:
+ return $this->getDbItunesSummary();
+ break;
+ case 11:
+ return $this->getDbItunesSubtitle();
+ break;
+ case 12:
+ return $this->getDbItunesCategory();
+ break;
+ case 13:
+ return $this->getDbItunesExplicit();
+ break;
+ case 14:
+ 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->getDbLanguage(),
+ $keys[6] => $this->getDbCopyright(),
+ $keys[7] => $this->getDbLink(),
+ $keys[8] => $this->getDbItunesAuthor(),
+ $keys[9] => $this->getDbItunesKeywords(),
+ $keys[10] => $this->getDbItunesSummary(),
+ $keys[11] => $this->getDbItunesSubtitle(),
+ $keys[12] => $this->getDbItunesCategory(),
+ $keys[13] => $this->getDbItunesExplicit(),
+ $keys[14] => $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->collStationPodcasts) {
+ $result['StationPodcasts'] = $this->collStationPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collImportedPodcasts) {
+ $result['ImportedPodcasts'] = $this->collImportedPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collPodcastEpisodess) {
+ $result['PodcastEpisodess'] = $this->collPodcastEpisodess->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->setDbLanguage($value);
+ break;
+ case 6:
+ $this->setDbCopyright($value);
+ break;
+ case 7:
+ $this->setDbLink($value);
+ break;
+ case 8:
+ $this->setDbItunesAuthor($value);
+ break;
+ case 9:
+ $this->setDbItunesKeywords($value);
+ break;
+ case 10:
+ $this->setDbItunesSummary($value);
+ break;
+ case 11:
+ $this->setDbItunesSubtitle($value);
+ break;
+ case 12:
+ $this->setDbItunesCategory($value);
+ break;
+ case 13:
+ $this->setDbItunesExplicit($value);
+ break;
+ case 14:
+ $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->setDbLanguage($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbCopyright($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbLink($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbItunesAuthor($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbItunesKeywords($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setDbItunesSummary($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDbItunesSubtitle($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setDbItunesCategory($arr[$keys[12]]);
+ if (array_key_exists($keys[13], $arr)) $this->setDbItunesExplicit($arr[$keys[13]]);
+ if (array_key_exists($keys[14], $arr)) $this->setDbOwner($arr[$keys[14]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(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::LANGUAGE)) $criteria->add(PodcastPeer::LANGUAGE, $this->language);
+ if ($this->isColumnModified(PodcastPeer::COPYRIGHT)) $criteria->add(PodcastPeer::COPYRIGHT, $this->copyright);
+ if ($this->isColumnModified(PodcastPeer::LINK)) $criteria->add(PodcastPeer::LINK, $this->link);
+ if ($this->isColumnModified(PodcastPeer::ITUNES_AUTHOR)) $criteria->add(PodcastPeer::ITUNES_AUTHOR, $this->itunes_author);
+ if ($this->isColumnModified(PodcastPeer::ITUNES_KEYWORDS)) $criteria->add(PodcastPeer::ITUNES_KEYWORDS, $this->itunes_keywords);
+ if ($this->isColumnModified(PodcastPeer::ITUNES_SUMMARY)) $criteria->add(PodcastPeer::ITUNES_SUMMARY, $this->itunes_summary);
+ if ($this->isColumnModified(PodcastPeer::ITUNES_SUBTITLE)) $criteria->add(PodcastPeer::ITUNES_SUBTITLE, $this->itunes_subtitle);
+ if ($this->isColumnModified(PodcastPeer::ITUNES_CATEGORY)) $criteria->add(PodcastPeer::ITUNES_CATEGORY, $this->itunes_category);
+ if ($this->isColumnModified(PodcastPeer::ITUNES_EXPLICIT)) $criteria->add(PodcastPeer::ITUNES_EXPLICIT, $this->itunes_explicit);
+ 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->setDbLanguage($this->getDbLanguage());
+ $copyObj->setDbCopyright($this->getDbCopyright());
+ $copyObj->setDbLink($this->getDbLink());
+ $copyObj->setDbItunesAuthor($this->getDbItunesAuthor());
+ $copyObj->setDbItunesKeywords($this->getDbItunesKeywords());
+ $copyObj->setDbItunesSummary($this->getDbItunesSummary());
+ $copyObj->setDbItunesSubtitle($this->getDbItunesSubtitle());
+ $copyObj->setDbItunesCategory($this->getDbItunesCategory());
+ $copyObj->setDbItunesExplicit($this->getDbItunesExplicit());
+ $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->getStationPodcasts() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addStationPodcast($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getImportedPodcasts() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addImportedPodcast($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getPodcastEpisodess() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addPodcastEpisodes($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 ('StationPodcast' == $relationName) {
+ $this->initStationPodcasts();
+ }
+ if ('ImportedPodcast' == $relationName) {
+ $this->initImportedPodcasts();
+ }
+ if ('PodcastEpisodes' == $relationName) {
+ $this->initPodcastEpisodess();
+ }
+ }
+
+ /**
+ * Clears out the collStationPodcasts 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 addStationPodcasts()
+ */
+ public function clearStationPodcasts()
+ {
+ $this->collStationPodcasts = null; // important to set this to null since that means it is uninitialized
+ $this->collStationPodcastsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collStationPodcasts collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialStationPodcasts($v = true)
+ {
+ $this->collStationPodcastsPartial = $v;
+ }
+
+ /**
+ * Initializes the collStationPodcasts collection.
+ *
+ * By default this just sets the collStationPodcasts collection to an empty array (like clearcollStationPodcasts());
+ * 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 initStationPodcasts($overrideExisting = true)
+ {
+ if (null !== $this->collStationPodcasts && !$overrideExisting) {
+ return;
+ }
+ $this->collStationPodcasts = new PropelObjectCollection();
+ $this->collStationPodcasts->setModel('StationPodcast');
+ }
+
+ /**
+ * Gets an array of StationPodcast 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|StationPodcast[] List of StationPodcast objects
+ * @throws PropelException
+ */
+ public function getStationPodcasts($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collStationPodcastsPartial && !$this->isNew();
+ if (null === $this->collStationPodcasts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collStationPodcasts) {
+ // return empty collection
+ $this->initStationPodcasts();
+ } else {
+ $collStationPodcasts = StationPodcastQuery::create(null, $criteria)
+ ->filterByPodcast($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collStationPodcastsPartial && count($collStationPodcasts)) {
+ $this->initStationPodcasts(false);
+
+ foreach ($collStationPodcasts as $obj) {
+ if (false == $this->collStationPodcasts->contains($obj)) {
+ $this->collStationPodcasts->append($obj);
+ }
+ }
+
+ $this->collStationPodcastsPartial = true;
+ }
+
+ $collStationPodcasts->getInternalIterator()->rewind();
+
+ return $collStationPodcasts;
+ }
+
+ if ($partial && $this->collStationPodcasts) {
+ foreach ($this->collStationPodcasts as $obj) {
+ if ($obj->isNew()) {
+ $collStationPodcasts[] = $obj;
+ }
+ }
+ }
+
+ $this->collStationPodcasts = $collStationPodcasts;
+ $this->collStationPodcastsPartial = false;
+ }
+ }
+
+ return $this->collStationPodcasts;
+ }
+
+ /**
+ * Sets a collection of StationPodcast 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 $stationPodcasts A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setStationPodcasts(PropelCollection $stationPodcasts, PropelPDO $con = null)
+ {
+ $stationPodcastsToDelete = $this->getStationPodcasts(new Criteria(), $con)->diff($stationPodcasts);
+
+
+ $this->stationPodcastsScheduledForDeletion = $stationPodcastsToDelete;
+
+ foreach ($stationPodcastsToDelete as $stationPodcastRemoved) {
+ $stationPodcastRemoved->setPodcast(null);
+ }
+
+ $this->collStationPodcasts = null;
+ foreach ($stationPodcasts as $stationPodcast) {
+ $this->addStationPodcast($stationPodcast);
+ }
+
+ $this->collStationPodcasts = $stationPodcasts;
+ $this->collStationPodcastsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related StationPodcast objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related StationPodcast objects.
+ * @throws PropelException
+ */
+ public function countStationPodcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collStationPodcastsPartial && !$this->isNew();
+ if (null === $this->collStationPodcasts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collStationPodcasts) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getStationPodcasts());
+ }
+ $query = StationPodcastQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByPodcast($this)
+ ->count($con);
+ }
+
+ return count($this->collStationPodcasts);
+ }
+
+ /**
+ * Method called to associate a StationPodcast object to this object
+ * through the StationPodcast foreign key attribute.
+ *
+ * @param StationPodcast $l StationPodcast
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function addStationPodcast(StationPodcast $l)
+ {
+ if ($this->collStationPodcasts === null) {
+ $this->initStationPodcasts();
+ $this->collStationPodcastsPartial = true;
+ }
+
+ if (!in_array($l, $this->collStationPodcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddStationPodcast($l);
+
+ if ($this->stationPodcastsScheduledForDeletion and $this->stationPodcastsScheduledForDeletion->contains($l)) {
+ $this->stationPodcastsScheduledForDeletion->remove($this->stationPodcastsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param StationPodcast $stationPodcast The stationPodcast object to add.
+ */
+ protected function doAddStationPodcast($stationPodcast)
+ {
+ $this->collStationPodcasts[]= $stationPodcast;
+ $stationPodcast->setPodcast($this);
+ }
+
+ /**
+ * @param StationPodcast $stationPodcast The stationPodcast object to remove.
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function removeStationPodcast($stationPodcast)
+ {
+ if ($this->getStationPodcasts()->contains($stationPodcast)) {
+ $this->collStationPodcasts->remove($this->collStationPodcasts->search($stationPodcast));
+ if (null === $this->stationPodcastsScheduledForDeletion) {
+ $this->stationPodcastsScheduledForDeletion = clone $this->collStationPodcasts;
+ $this->stationPodcastsScheduledForDeletion->clear();
+ }
+ $this->stationPodcastsScheduledForDeletion[]= clone $stationPodcast;
+ $stationPodcast->setPodcast(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collImportedPodcasts 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 addImportedPodcasts()
+ */
+ public function clearImportedPodcasts()
+ {
+ $this->collImportedPodcasts = null; // important to set this to null since that means it is uninitialized
+ $this->collImportedPodcastsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collImportedPodcasts collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialImportedPodcasts($v = true)
+ {
+ $this->collImportedPodcastsPartial = $v;
+ }
+
+ /**
+ * Initializes the collImportedPodcasts collection.
+ *
+ * By default this just sets the collImportedPodcasts collection to an empty array (like clearcollImportedPodcasts());
+ * 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 initImportedPodcasts($overrideExisting = true)
+ {
+ if (null !== $this->collImportedPodcasts && !$overrideExisting) {
+ return;
+ }
+ $this->collImportedPodcasts = new PropelObjectCollection();
+ $this->collImportedPodcasts->setModel('ImportedPodcast');
+ }
+
+ /**
+ * Gets an array of ImportedPodcast 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|ImportedPodcast[] List of ImportedPodcast objects
+ * @throws PropelException
+ */
+ public function getImportedPodcasts($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collImportedPodcastsPartial && !$this->isNew();
+ if (null === $this->collImportedPodcasts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collImportedPodcasts) {
+ // return empty collection
+ $this->initImportedPodcasts();
+ } else {
+ $collImportedPodcasts = ImportedPodcastQuery::create(null, $criteria)
+ ->filterByPodcast($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collImportedPodcastsPartial && count($collImportedPodcasts)) {
+ $this->initImportedPodcasts(false);
+
+ foreach ($collImportedPodcasts as $obj) {
+ if (false == $this->collImportedPodcasts->contains($obj)) {
+ $this->collImportedPodcasts->append($obj);
+ }
+ }
+
+ $this->collImportedPodcastsPartial = true;
+ }
+
+ $collImportedPodcasts->getInternalIterator()->rewind();
+
+ return $collImportedPodcasts;
+ }
+
+ if ($partial && $this->collImportedPodcasts) {
+ foreach ($this->collImportedPodcasts as $obj) {
+ if ($obj->isNew()) {
+ $collImportedPodcasts[] = $obj;
+ }
+ }
+ }
+
+ $this->collImportedPodcasts = $collImportedPodcasts;
+ $this->collImportedPodcastsPartial = false;
+ }
+ }
+
+ return $this->collImportedPodcasts;
+ }
+
+ /**
+ * Sets a collection of ImportedPodcast 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 $importedPodcasts A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setImportedPodcasts(PropelCollection $importedPodcasts, PropelPDO $con = null)
+ {
+ $importedPodcastsToDelete = $this->getImportedPodcasts(new Criteria(), $con)->diff($importedPodcasts);
+
+
+ $this->importedPodcastsScheduledForDeletion = $importedPodcastsToDelete;
+
+ foreach ($importedPodcastsToDelete as $importedPodcastRemoved) {
+ $importedPodcastRemoved->setPodcast(null);
+ }
+
+ $this->collImportedPodcasts = null;
+ foreach ($importedPodcasts as $importedPodcast) {
+ $this->addImportedPodcast($importedPodcast);
+ }
+
+ $this->collImportedPodcasts = $importedPodcasts;
+ $this->collImportedPodcastsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related ImportedPodcast objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related ImportedPodcast objects.
+ * @throws PropelException
+ */
+ public function countImportedPodcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collImportedPodcastsPartial && !$this->isNew();
+ if (null === $this->collImportedPodcasts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collImportedPodcasts) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getImportedPodcasts());
+ }
+ $query = ImportedPodcastQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByPodcast($this)
+ ->count($con);
+ }
+
+ return count($this->collImportedPodcasts);
+ }
+
+ /**
+ * Method called to associate a ImportedPodcast object to this object
+ * through the ImportedPodcast foreign key attribute.
+ *
+ * @param ImportedPodcast $l ImportedPodcast
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function addImportedPodcast(ImportedPodcast $l)
+ {
+ if ($this->collImportedPodcasts === null) {
+ $this->initImportedPodcasts();
+ $this->collImportedPodcastsPartial = true;
+ }
+
+ if (!in_array($l, $this->collImportedPodcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddImportedPodcast($l);
+
+ if ($this->importedPodcastsScheduledForDeletion and $this->importedPodcastsScheduledForDeletion->contains($l)) {
+ $this->importedPodcastsScheduledForDeletion->remove($this->importedPodcastsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ImportedPodcast $importedPodcast The importedPodcast object to add.
+ */
+ protected function doAddImportedPodcast($importedPodcast)
+ {
+ $this->collImportedPodcasts[]= $importedPodcast;
+ $importedPodcast->setPodcast($this);
+ }
+
+ /**
+ * @param ImportedPodcast $importedPodcast The importedPodcast object to remove.
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function removeImportedPodcast($importedPodcast)
+ {
+ if ($this->getImportedPodcasts()->contains($importedPodcast)) {
+ $this->collImportedPodcasts->remove($this->collImportedPodcasts->search($importedPodcast));
+ if (null === $this->importedPodcastsScheduledForDeletion) {
+ $this->importedPodcastsScheduledForDeletion = clone $this->collImportedPodcasts;
+ $this->importedPodcastsScheduledForDeletion->clear();
+ }
+ $this->importedPodcastsScheduledForDeletion[]= clone $importedPodcast;
+ $importedPodcast->setPodcast(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collPodcastEpisodess 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 addPodcastEpisodess()
+ */
+ public function clearPodcastEpisodess()
+ {
+ $this->collPodcastEpisodess = null; // important to set this to null since that means it is uninitialized
+ $this->collPodcastEpisodessPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collPodcastEpisodess collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialPodcastEpisodess($v = true)
+ {
+ $this->collPodcastEpisodessPartial = $v;
+ }
+
+ /**
+ * Initializes the collPodcastEpisodess collection.
+ *
+ * By default this just sets the collPodcastEpisodess collection to an empty array (like clearcollPodcastEpisodess());
+ * 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 initPodcastEpisodess($overrideExisting = true)
+ {
+ if (null !== $this->collPodcastEpisodess && !$overrideExisting) {
+ return;
+ }
+ $this->collPodcastEpisodess = new PropelObjectCollection();
+ $this->collPodcastEpisodess->setModel('PodcastEpisodes');
+ }
+
+ /**
+ * Gets an array of PodcastEpisodes 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|PodcastEpisodes[] List of PodcastEpisodes objects
+ * @throws PropelException
+ */
+ public function getPodcastEpisodess($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collPodcastEpisodessPartial && !$this->isNew();
+ if (null === $this->collPodcastEpisodess || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collPodcastEpisodess) {
+ // return empty collection
+ $this->initPodcastEpisodess();
+ } else {
+ $collPodcastEpisodess = PodcastEpisodesQuery::create(null, $criteria)
+ ->filterByPodcast($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collPodcastEpisodessPartial && count($collPodcastEpisodess)) {
+ $this->initPodcastEpisodess(false);
+
+ foreach ($collPodcastEpisodess as $obj) {
+ if (false == $this->collPodcastEpisodess->contains($obj)) {
+ $this->collPodcastEpisodess->append($obj);
+ }
+ }
+
+ $this->collPodcastEpisodessPartial = true;
+ }
+
+ $collPodcastEpisodess->getInternalIterator()->rewind();
+
+ return $collPodcastEpisodess;
+ }
+
+ if ($partial && $this->collPodcastEpisodess) {
+ foreach ($this->collPodcastEpisodess as $obj) {
+ if ($obj->isNew()) {
+ $collPodcastEpisodess[] = $obj;
+ }
+ }
+ }
+
+ $this->collPodcastEpisodess = $collPodcastEpisodess;
+ $this->collPodcastEpisodessPartial = false;
+ }
+ }
+
+ return $this->collPodcastEpisodess;
+ }
+
+ /**
+ * Sets a collection of PodcastEpisodes 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 $podcastEpisodess A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function setPodcastEpisodess(PropelCollection $podcastEpisodess, PropelPDO $con = null)
+ {
+ $podcastEpisodessToDelete = $this->getPodcastEpisodess(new Criteria(), $con)->diff($podcastEpisodess);
+
+
+ $this->podcastEpisodessScheduledForDeletion = $podcastEpisodessToDelete;
+
+ foreach ($podcastEpisodessToDelete as $podcastEpisodesRemoved) {
+ $podcastEpisodesRemoved->setPodcast(null);
+ }
+
+ $this->collPodcastEpisodess = null;
+ foreach ($podcastEpisodess as $podcastEpisodes) {
+ $this->addPodcastEpisodes($podcastEpisodes);
+ }
+
+ $this->collPodcastEpisodess = $podcastEpisodess;
+ $this->collPodcastEpisodessPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related PodcastEpisodes objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related PodcastEpisodes objects.
+ * @throws PropelException
+ */
+ public function countPodcastEpisodess(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collPodcastEpisodessPartial && !$this->isNew();
+ if (null === $this->collPodcastEpisodess || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collPodcastEpisodess) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getPodcastEpisodess());
+ }
+ $query = PodcastEpisodesQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByPodcast($this)
+ ->count($con);
+ }
+
+ return count($this->collPodcastEpisodess);
+ }
+
+ /**
+ * Method called to associate a PodcastEpisodes object to this object
+ * through the PodcastEpisodes foreign key attribute.
+ *
+ * @param PodcastEpisodes $l PodcastEpisodes
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function addPodcastEpisodes(PodcastEpisodes $l)
+ {
+ if ($this->collPodcastEpisodess === null) {
+ $this->initPodcastEpisodess();
+ $this->collPodcastEpisodessPartial = true;
+ }
+
+ if (!in_array($l, $this->collPodcastEpisodess->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddPodcastEpisodes($l);
+
+ if ($this->podcastEpisodessScheduledForDeletion and $this->podcastEpisodessScheduledForDeletion->contains($l)) {
+ $this->podcastEpisodessScheduledForDeletion->remove($this->podcastEpisodessScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param PodcastEpisodes $podcastEpisodes The podcastEpisodes object to add.
+ */
+ protected function doAddPodcastEpisodes($podcastEpisodes)
+ {
+ $this->collPodcastEpisodess[]= $podcastEpisodes;
+ $podcastEpisodes->setPodcast($this);
+ }
+
+ /**
+ * @param PodcastEpisodes $podcastEpisodes The podcastEpisodes object to remove.
+ * @return Podcast The current object (for fluent API support)
+ */
+ public function removePodcastEpisodes($podcastEpisodes)
+ {
+ if ($this->getPodcastEpisodess()->contains($podcastEpisodes)) {
+ $this->collPodcastEpisodess->remove($this->collPodcastEpisodess->search($podcastEpisodes));
+ if (null === $this->podcastEpisodessScheduledForDeletion) {
+ $this->podcastEpisodessScheduledForDeletion = clone $this->collPodcastEpisodess;
+ $this->podcastEpisodessScheduledForDeletion->clear();
+ }
+ $this->podcastEpisodessScheduledForDeletion[]= clone $podcastEpisodes;
+ $podcastEpisodes->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 PodcastEpisodess 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|PodcastEpisodes[] List of PodcastEpisodes objects
+ */
+ public function getPodcastEpisodessJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = PodcastEpisodesQuery::create(null, $criteria);
+ $query->joinWith('CcFiles', $join_behavior);
+
+ return $this->getPodcastEpisodess($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->language = null;
+ $this->copyright = null;
+ $this->link = null;
+ $this->itunes_author = null;
+ $this->itunes_keywords = null;
+ $this->itunes_summary = null;
+ $this->itunes_subtitle = null;
+ $this->itunes_category = null;
+ $this->itunes_explicit = null;
+ $this->owner = 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->collStationPodcasts) {
+ foreach ($this->collStationPodcasts as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collImportedPodcasts) {
+ foreach ($this->collImportedPodcasts as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collPodcastEpisodess) {
+ foreach ($this->collPodcastEpisodess as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collStationPodcasts instanceof PropelCollection) {
+ $this->collStationPodcasts->clearIterator();
+ }
+ $this->collStationPodcasts = null;
+ if ($this->collImportedPodcasts instanceof PropelCollection) {
+ $this->collImportedPodcasts->clearIterator();
+ }
+ $this->collImportedPodcasts = null;
+ if ($this->collPodcastEpisodess instanceof PropelCollection) {
+ $this->collPodcastEpisodess->clearIterator();
+ }
+ $this->collPodcastEpisodess = 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/BasePodcastEpisodes.php b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodes.php
new file mode 100644
index 000000000..e39015230
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodes.php
@@ -0,0 +1,1274 @@
+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);
+
+ }
+
+ /**
+ * Get the [download_url] column value.
+ *
+ * @return string
+ */
+ public function getDbDownloadUrl()
+ {
+
+ return $this->download_url;
+ }
+
+ /**
+ * Get the [episode_guid] column value.
+ *
+ * @return string
+ */
+ public function getDbEpisodeGuid()
+ {
+
+ return $this->episode_guid;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return PodcastEpisodes 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[] = PodcastEpisodesPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [file_id] column.
+ *
+ * @param int $v new value
+ * @return PodcastEpisodes 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[] = PodcastEpisodesPeer::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 PodcastEpisodes 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[] = PodcastEpisodesPeer::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 PodcastEpisodes 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[] = PodcastEpisodesPeer::PUBLICATION_DATE;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbPublicationDate()
+
+ /**
+ * Set the value of [download_url] column.
+ *
+ * @param string $v new value
+ * @return PodcastEpisodes The current object (for fluent API support)
+ */
+ public function setDbDownloadUrl($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->download_url !== $v) {
+ $this->download_url = $v;
+ $this->modifiedColumns[] = PodcastEpisodesPeer::DOWNLOAD_URL;
+ }
+
+
+ return $this;
+ } // setDbDownloadUrl()
+
+ /**
+ * Set the value of [episode_guid] column.
+ *
+ * @param string $v new value
+ * @return PodcastEpisodes The current object (for fluent API support)
+ */
+ public function setDbEpisodeGuid($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->episode_guid !== $v) {
+ $this->episode_guid = $v;
+ $this->modifiedColumns[] = PodcastEpisodesPeer::EPISODE_GUID;
+ }
+
+
+ return $this;
+ } // setDbEpisodeGuid()
+
+ /**
+ * 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->download_url = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->episode_guid = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 6; // 6 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating PodcastEpisodes 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(PodcastEpisodesPeer::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 = PodcastEpisodesPeer::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(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = PodcastEpisodesQuery::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(PodcastEpisodesPeer::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);
+ PodcastEpisodesPeer::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[] = PodcastEpisodesPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . PodcastEpisodesPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('podcast_episodes_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(PodcastEpisodesPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(PodcastEpisodesPeer::FILE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"file_id"';
+ }
+ if ($this->isColumnModified(PodcastEpisodesPeer::PODCAST_ID)) {
+ $modifiedColumns[':p' . $index++] = '"podcast_id"';
+ }
+ if ($this->isColumnModified(PodcastEpisodesPeer::PUBLICATION_DATE)) {
+ $modifiedColumns[':p' . $index++] = '"publication_date"';
+ }
+ if ($this->isColumnModified(PodcastEpisodesPeer::DOWNLOAD_URL)) {
+ $modifiedColumns[':p' . $index++] = '"download_url"';
+ }
+ if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_GUID)) {
+ $modifiedColumns[':p' . $index++] = '"episode_guid"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "podcast_episodes" (%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;
+ case '"download_url"':
+ $stmt->bindValue($identifier, $this->download_url, PDO::PARAM_STR);
+ break;
+ case '"episode_guid"':
+ $stmt->bindValue($identifier, $this->episode_guid, 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 = PodcastEpisodesPeer::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 = PodcastEpisodesPeer::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;
+ case 4:
+ return $this->getDbDownloadUrl();
+ break;
+ case 5:
+ return $this->getDbEpisodeGuid();
+ 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['PodcastEpisodes'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['PodcastEpisodes'][$this->getPrimaryKey()] = true;
+ $keys = PodcastEpisodesPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbFileId(),
+ $keys[2] => $this->getDbPodcastId(),
+ $keys[3] => $this->getDbPublicationDate(),
+ $keys[4] => $this->getDbDownloadUrl(),
+ $keys[5] => $this->getDbEpisodeGuid(),
+ );
+ $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 = PodcastEpisodesPeer::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;
+ case 4:
+ $this->setDbDownloadUrl($value);
+ break;
+ case 5:
+ $this->setDbEpisodeGuid($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 = PodcastEpisodesPeer::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]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbDownloadUrl($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbEpisodeGuid($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(PodcastEpisodesPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(PodcastEpisodesPeer::ID)) $criteria->add(PodcastEpisodesPeer::ID, $this->id);
+ if ($this->isColumnModified(PodcastEpisodesPeer::FILE_ID)) $criteria->add(PodcastEpisodesPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(PodcastEpisodesPeer::PODCAST_ID)) $criteria->add(PodcastEpisodesPeer::PODCAST_ID, $this->podcast_id);
+ if ($this->isColumnModified(PodcastEpisodesPeer::PUBLICATION_DATE)) $criteria->add(PodcastEpisodesPeer::PUBLICATION_DATE, $this->publication_date);
+ if ($this->isColumnModified(PodcastEpisodesPeer::DOWNLOAD_URL)) $criteria->add(PodcastEpisodesPeer::DOWNLOAD_URL, $this->download_url);
+ if ($this->isColumnModified(PodcastEpisodesPeer::EPISODE_GUID)) $criteria->add(PodcastEpisodesPeer::EPISODE_GUID, $this->episode_guid);
+
+ 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(PodcastEpisodesPeer::DATABASE_NAME);
+ $criteria->add(PodcastEpisodesPeer::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 PodcastEpisodes (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());
+ $copyObj->setDbDownloadUrl($this->getDbDownloadUrl());
+ $copyObj->setDbEpisodeGuid($this->getDbEpisodeGuid());
+
+ 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 PodcastEpisodes 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 PodcastEpisodesPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new PodcastEpisodesPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcFiles object.
+ *
+ * @param CcFiles $v
+ * @return PodcastEpisodes 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->addPodcastEpisodes($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->addPodcastEpisodess($this);
+ */
+ }
+
+ return $this->aCcFiles;
+ }
+
+ /**
+ * Declares an association between this object and a Podcast object.
+ *
+ * @param Podcast $v
+ * @return PodcastEpisodes 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->addPodcastEpisodes($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->addPodcastEpisodess($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->download_url = null;
+ $this->episode_guid = 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(PodcastEpisodesPeer::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/BasePodcastEpisodesPeer.php b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesPeer.php
new file mode 100644
index 000000000..3415c9345
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesPeer.php
@@ -0,0 +1,1412 @@
+ array ('DbId', 'DbFileId', 'DbPodcastId', 'DbPublicationDate', 'DbDownloadUrl', 'DbEpisodeGuid', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbPodcastId', 'dbPublicationDate', 'dbDownloadUrl', 'dbEpisodeGuid', ),
+ BasePeer::TYPE_COLNAME => array (PodcastEpisodesPeer::ID, PodcastEpisodesPeer::FILE_ID, PodcastEpisodesPeer::PODCAST_ID, PodcastEpisodesPeer::PUBLICATION_DATE, PodcastEpisodesPeer::DOWNLOAD_URL, PodcastEpisodesPeer::EPISODE_GUID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'PODCAST_ID', 'PUBLICATION_DATE', 'DOWNLOAD_URL', 'EPISODE_GUID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'podcast_id', 'publication_date', 'download_url', 'episode_guid', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. PodcastEpisodesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbPodcastId' => 2, 'DbPublicationDate' => 3, 'DbDownloadUrl' => 4, 'DbEpisodeGuid' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbPodcastId' => 2, 'dbPublicationDate' => 3, 'dbDownloadUrl' => 4, 'dbEpisodeGuid' => 5, ),
+ BasePeer::TYPE_COLNAME => array (PodcastEpisodesPeer::ID => 0, PodcastEpisodesPeer::FILE_ID => 1, PodcastEpisodesPeer::PODCAST_ID => 2, PodcastEpisodesPeer::PUBLICATION_DATE => 3, PodcastEpisodesPeer::DOWNLOAD_URL => 4, PodcastEpisodesPeer::EPISODE_GUID => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'PODCAST_ID' => 2, 'PUBLICATION_DATE' => 3, 'DOWNLOAD_URL' => 4, 'EPISODE_GUID' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'podcast_id' => 2, 'publication_date' => 3, 'download_url' => 4, 'episode_guid' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = PodcastEpisodesPeer::getFieldNames($toType);
+ $key = isset(PodcastEpisodesPeer::$fieldKeys[$fromType][$name]) ? PodcastEpisodesPeer::$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(PodcastEpisodesPeer::$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, PodcastEpisodesPeer::$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 PodcastEpisodesPeer::$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. PodcastEpisodesPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(PodcastEpisodesPeer::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(PodcastEpisodesPeer::ID);
+ $criteria->addSelectColumn(PodcastEpisodesPeer::FILE_ID);
+ $criteria->addSelectColumn(PodcastEpisodesPeer::PODCAST_ID);
+ $criteria->addSelectColumn(PodcastEpisodesPeer::PUBLICATION_DATE);
+ $criteria->addSelectColumn(PodcastEpisodesPeer::DOWNLOAD_URL);
+ $criteria->addSelectColumn(PodcastEpisodesPeer::EPISODE_GUID);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.file_id');
+ $criteria->addSelectColumn($alias . '.podcast_id');
+ $criteria->addSelectColumn($alias . '.publication_date');
+ $criteria->addSelectColumn($alias . '.download_url');
+ $criteria->addSelectColumn($alias . '.episode_guid');
+ }
+ }
+
+ /**
+ * 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(PodcastEpisodesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(PodcastEpisodesPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::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 PodcastEpisodes
+ * @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 = PodcastEpisodesPeer::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 PodcastEpisodesPeer::populateObjects(PodcastEpisodesPeer::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(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::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 PodcastEpisodes $obj A PodcastEpisodes 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
+ PodcastEpisodesPeer::$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 PodcastEpisodes 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 PodcastEpisodes) {
+ $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 PodcastEpisodes object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(PodcastEpisodesPeer::$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 PodcastEpisodes 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(PodcastEpisodesPeer::$instances[$key])) {
+ return PodcastEpisodesPeer::$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 (PodcastEpisodesPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ PodcastEpisodesPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to podcast_episodes
+ * 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 = PodcastEpisodesPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = PodcastEpisodesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = PodcastEpisodesPeer::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;
+ PodcastEpisodesPeer::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 (PodcastEpisodes object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = PodcastEpisodesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = PodcastEpisodesPeer::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 + PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = PodcastEpisodesPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ PodcastEpisodesPeer::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(PodcastEpisodesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(PodcastEpisodesPeer::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(PodcastEpisodesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(PodcastEpisodesPeer::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 PodcastEpisodes 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 PodcastEpisodes 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(PodcastEpisodesPeer::DATABASE_NAME);
+ }
+
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ $startcol = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS;
+ CcFilesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(PodcastEpisodesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = PodcastEpisodesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = PodcastEpisodesPeer::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 = PodcastEpisodesPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ PodcastEpisodesPeer::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 (PodcastEpisodes) to $obj2 (CcFiles)
+ $obj2->addPodcastEpisodes($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of PodcastEpisodes 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 PodcastEpisodes 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(PodcastEpisodesPeer::DATABASE_NAME);
+ }
+
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ $startcol = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS;
+ PodcastPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(PodcastEpisodesPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = PodcastEpisodesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = PodcastEpisodesPeer::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 = PodcastEpisodesPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ PodcastEpisodesPeer::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 (PodcastEpisodes) to $obj2 (Podcast)
+ $obj2->addPodcastEpisodes($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(PodcastEpisodesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(PodcastEpisodesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(PodcastEpisodesPeer::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 PodcastEpisodes 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 PodcastEpisodes 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(PodcastEpisodesPeer::DATABASE_NAME);
+ }
+
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ $startcol2 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ PodcastPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + PodcastPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(PodcastEpisodesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(PodcastEpisodesPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = PodcastEpisodesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = PodcastEpisodesPeer::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 = PodcastEpisodesPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ PodcastEpisodesPeer::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 (PodcastEpisodes) to the collection in $obj2 (CcFiles)
+ $obj2->addPodcastEpisodes($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 (PodcastEpisodes) to the collection in $obj3 (Podcast)
+ $obj3->addPodcastEpisodes($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(PodcastEpisodesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(PodcastEpisodesPeer::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(PodcastEpisodesPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(PodcastEpisodesPeer::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 PodcastEpisodes 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 PodcastEpisodes 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(PodcastEpisodesPeer::DATABASE_NAME);
+ }
+
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ $startcol2 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS;
+
+ PodcastPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(PodcastEpisodesPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = PodcastEpisodesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = PodcastEpisodesPeer::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 = PodcastEpisodesPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ PodcastEpisodesPeer::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 (PodcastEpisodes) to the collection in $obj2 (Podcast)
+ $obj2->addPodcastEpisodes($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of PodcastEpisodes 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 PodcastEpisodes 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(PodcastEpisodesPeer::DATABASE_NAME);
+ }
+
+ PodcastEpisodesPeer::addSelectColumns($criteria);
+ $startcol2 = PodcastEpisodesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(PodcastEpisodesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = PodcastEpisodesPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = PodcastEpisodesPeer::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 = PodcastEpisodesPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ PodcastEpisodesPeer::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 (PodcastEpisodes) to the collection in $obj2 (CcFiles)
+ $obj2->addPodcastEpisodes($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(PodcastEpisodesPeer::DATABASE_NAME)->getTable(PodcastEpisodesPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BasePodcastEpisodesPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BasePodcastEpisodesPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \PodcastEpisodesTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return PodcastEpisodesPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a PodcastEpisodes or Criteria object.
+ *
+ * @param mixed $values Criteria or PodcastEpisodes 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(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from PodcastEpisodes object
+ }
+
+ if ($criteria->containsKey(PodcastEpisodesPeer::ID) && $criteria->keyContainsValue(PodcastEpisodesPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.PodcastEpisodesPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::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 PodcastEpisodes or Criteria object.
+ *
+ * @param mixed $values Criteria or PodcastEpisodes 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(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(PodcastEpisodesPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(PodcastEpisodesPeer::ID);
+ $value = $criteria->remove(PodcastEpisodesPeer::ID);
+ if ($value) {
+ $selectCriteria->add(PodcastEpisodesPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(PodcastEpisodesPeer::TABLE_NAME);
+ }
+
+ } else { // $values is PodcastEpisodes object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the podcast_episodes 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(PodcastEpisodesPeer::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(PodcastEpisodesPeer::TABLE_NAME, $con, PodcastEpisodesPeer::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).
+ PodcastEpisodesPeer::clearInstancePool();
+ PodcastEpisodesPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a PodcastEpisodes or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or PodcastEpisodes 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(PodcastEpisodesPeer::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.
+ PodcastEpisodesPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof PodcastEpisodes) { // it's a model object
+ // invalidate the cache for this single object
+ PodcastEpisodesPeer::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(PodcastEpisodesPeer::DATABASE_NAME);
+ $criteria->add(PodcastEpisodesPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ PodcastEpisodesPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(PodcastEpisodesPeer::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);
+ PodcastEpisodesPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given PodcastEpisodes 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 PodcastEpisodes $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(PodcastEpisodesPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(PodcastEpisodesPeer::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(PodcastEpisodesPeer::DATABASE_NAME, PodcastEpisodesPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return PodcastEpisodes
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = PodcastEpisodesPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(PodcastEpisodesPeer::DATABASE_NAME);
+ $criteria->add(PodcastEpisodesPeer::ID, $pk);
+
+ $v = PodcastEpisodesPeer::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 PodcastEpisodes[]
+ * @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(PodcastEpisodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(PodcastEpisodesPeer::DATABASE_NAME);
+ $criteria->add(PodcastEpisodesPeer::ID, $pks, Criteria::IN);
+ $objs = PodcastEpisodesPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
+
+} // BasePodcastEpisodesPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BasePodcastEpisodesPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesQuery.php b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesQuery.php
new file mode 100644
index 000000000..fbf44a00f
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BasePodcastEpisodesQuery.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 PodcastEpisodes|PodcastEpisodes[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = PodcastEpisodesPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(PodcastEpisodesPeer::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 PodcastEpisodes 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 PodcastEpisodes 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", "download_url", "episode_guid" FROM "podcast_episodes" 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 PodcastEpisodes();
+ $obj->hydrate($row);
+ PodcastEpisodesPeer::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 PodcastEpisodes|PodcastEpisodes[]|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|PodcastEpisodes[]|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 PodcastEpisodesQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::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 PodcastEpisodesQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::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 PodcastEpisodesQuery 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(PodcastEpisodesPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(PodcastEpisodesPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::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 PodcastEpisodesQuery 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(PodcastEpisodesPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFileId['max'])) {
+ $this->addUsingAlias(PodcastEpisodesPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::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 PodcastEpisodesQuery 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(PodcastEpisodesPeer::PODCAST_ID, $dbPodcastId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPodcastId['max'])) {
+ $this->addUsingAlias(PodcastEpisodesPeer::PODCAST_ID, $dbPodcastId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::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 PodcastEpisodesQuery 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(PodcastEpisodesPeer::PUBLICATION_DATE, $dbPublicationDate['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPublicationDate['max'])) {
+ $this->addUsingAlias(PodcastEpisodesPeer::PUBLICATION_DATE, $dbPublicationDate['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::PUBLICATION_DATE, $dbPublicationDate, $comparison);
+ }
+
+ /**
+ * Filter the query on the download_url column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDownloadUrl('fooValue'); // WHERE download_url = 'fooValue'
+ * $query->filterByDbDownloadUrl('%fooValue%'); // WHERE download_url LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbDownloadUrl The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return PodcastEpisodesQuery The current query, for fluid interface
+ */
+ public function filterByDbDownloadUrl($dbDownloadUrl = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbDownloadUrl)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbDownloadUrl)) {
+ $dbDownloadUrl = str_replace('*', '%', $dbDownloadUrl);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::DOWNLOAD_URL, $dbDownloadUrl, $comparison);
+ }
+
+ /**
+ * Filter the query on the episode_guid column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEpisodeGuid('fooValue'); // WHERE episode_guid = 'fooValue'
+ * $query->filterByDbEpisodeGuid('%fooValue%'); // WHERE episode_guid LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbEpisodeGuid The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return PodcastEpisodesQuery The current query, for fluid interface
+ */
+ public function filterByDbEpisodeGuid($dbEpisodeGuid = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbEpisodeGuid)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbEpisodeGuid)) {
+ $dbEpisodeGuid = str_replace('*', '%', $dbEpisodeGuid);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastEpisodesPeer::EPISODE_GUID, $dbEpisodeGuid, $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 PodcastEpisodesQuery 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(PodcastEpisodesPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(PodcastEpisodesPeer::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 PodcastEpisodesQuery The current query, for fluid interface
+ */
+ public function joinCcFiles($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcFiles');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcFiles');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcFiles relation CcFiles object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcFilesQuery A secondary query class using the current class as primary query
+ */
+ public function useCcFilesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related 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 PodcastEpisodesQuery 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(PodcastEpisodesPeer::PODCAST_ID, $podcast->getDbId(), $comparison);
+ } elseif ($podcast instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(PodcastEpisodesPeer::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 PodcastEpisodesQuery 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 PodcastEpisodes $podcastEpisodes Object to remove from the list of results
+ *
+ * @return PodcastEpisodesQuery The current query, for fluid interface
+ */
+ public function prune($podcastEpisodes = null)
+ {
+ if ($podcastEpisodes) {
+ $this->addUsingAlias(PodcastEpisodesPeer::ID, $podcastEpisodes->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..5bf6d4a6b
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php
@@ -0,0 +1,1073 @@
+ array ('DbId', 'DbUrl', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbLink', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbOwner', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUrl', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbLink', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbOwner', ),
+ BasePeer::TYPE_COLNAME => array (PodcastPeer::ID, PodcastPeer::URL, PodcastPeer::TITLE, PodcastPeer::CREATOR, PodcastPeer::DESCRIPTION, PodcastPeer::LANGUAGE, PodcastPeer::COPYRIGHT, PodcastPeer::LINK, PodcastPeer::ITUNES_AUTHOR, PodcastPeer::ITUNES_KEYWORDS, PodcastPeer::ITUNES_SUMMARY, PodcastPeer::ITUNES_SUBTITLE, PodcastPeer::ITUNES_CATEGORY, PodcastPeer::ITUNES_EXPLICIT, PodcastPeer::OWNER, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'URL', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'LINK', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'OWNER', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'url', 'title', 'creator', 'description', 'language', 'copyright', 'link', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'owner', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. 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, 'DbLanguage' => 5, 'DbCopyright' => 6, 'DbLink' => 7, 'DbItunesAuthor' => 8, 'DbItunesKeywords' => 9, 'DbItunesSummary' => 10, 'DbItunesSubtitle' => 11, 'DbItunesCategory' => 12, 'DbItunesExplicit' => 13, 'DbOwner' => 14, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUrl' => 1, 'dbTitle' => 2, 'dbCreator' => 3, 'dbDescription' => 4, 'dbLanguage' => 5, 'dbCopyright' => 6, 'dbLink' => 7, 'dbItunesAuthor' => 8, 'dbItunesKeywords' => 9, 'dbItunesSummary' => 10, 'dbItunesSubtitle' => 11, 'dbItunesCategory' => 12, 'dbItunesExplicit' => 13, 'dbOwner' => 14, ),
+ BasePeer::TYPE_COLNAME => array (PodcastPeer::ID => 0, PodcastPeer::URL => 1, PodcastPeer::TITLE => 2, PodcastPeer::CREATOR => 3, PodcastPeer::DESCRIPTION => 4, PodcastPeer::LANGUAGE => 5, PodcastPeer::COPYRIGHT => 6, PodcastPeer::LINK => 7, PodcastPeer::ITUNES_AUTHOR => 8, PodcastPeer::ITUNES_KEYWORDS => 9, PodcastPeer::ITUNES_SUMMARY => 10, PodcastPeer::ITUNES_SUBTITLE => 11, PodcastPeer::ITUNES_CATEGORY => 12, PodcastPeer::ITUNES_EXPLICIT => 13, PodcastPeer::OWNER => 14, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'URL' => 1, 'TITLE' => 2, 'CREATOR' => 3, 'DESCRIPTION' => 4, 'LANGUAGE' => 5, 'COPYRIGHT' => 6, 'LINK' => 7, 'ITUNES_AUTHOR' => 8, 'ITUNES_KEYWORDS' => 9, 'ITUNES_SUMMARY' => 10, 'ITUNES_SUBTITLE' => 11, 'ITUNES_CATEGORY' => 12, 'ITUNES_EXPLICIT' => 13, 'OWNER' => 14, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'url' => 1, 'title' => 2, 'creator' => 3, 'description' => 4, 'language' => 5, 'copyright' => 6, 'link' => 7, 'itunes_author' => 8, 'itunes_keywords' => 9, 'itunes_summary' => 10, 'itunes_subtitle' => 11, 'itunes_category' => 12, 'itunes_explicit' => 13, 'owner' => 14, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = 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::LANGUAGE);
+ $criteria->addSelectColumn(PodcastPeer::COPYRIGHT);
+ $criteria->addSelectColumn(PodcastPeer::LINK);
+ $criteria->addSelectColumn(PodcastPeer::ITUNES_AUTHOR);
+ $criteria->addSelectColumn(PodcastPeer::ITUNES_KEYWORDS);
+ $criteria->addSelectColumn(PodcastPeer::ITUNES_SUMMARY);
+ $criteria->addSelectColumn(PodcastPeer::ITUNES_SUBTITLE);
+ $criteria->addSelectColumn(PodcastPeer::ITUNES_CATEGORY);
+ $criteria->addSelectColumn(PodcastPeer::ITUNES_EXPLICIT);
+ $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 . '.language');
+ $criteria->addSelectColumn($alias . '.copyright');
+ $criteria->addSelectColumn($alias . '.link');
+ $criteria->addSelectColumn($alias . '.itunes_author');
+ $criteria->addSelectColumn($alias . '.itunes_keywords');
+ $criteria->addSelectColumn($alias . '.itunes_summary');
+ $criteria->addSelectColumn($alias . '.itunes_subtitle');
+ $criteria->addSelectColumn($alias . '.itunes_category');
+ $criteria->addSelectColumn($alias . '.itunes_explicit');
+ $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 StationPodcastPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ StationPodcastPeer::clearInstancePool();
+ // Invalidate objects in ImportedPodcastPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ ImportedPodcastPeer::clearInstancePool();
+ // Invalidate objects in PodcastEpisodesPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ PodcastEpisodesPeer::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..250cab2b5
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php
@@ -0,0 +1,1067 @@
+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", "language", "copyright", "link", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "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 language column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLanguage('fooValue'); // WHERE language = 'fooValue'
+ * $query->filterByDbLanguage('%fooValue%'); // WHERE language LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLanguage The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return PodcastQuery The current query, for fluid interface
+ */
+ public function filterByDbLanguage($dbLanguage = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLanguage)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLanguage)) {
+ $dbLanguage = str_replace('*', '%', $dbLanguage);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::LANGUAGE, $dbLanguage, $comparison);
+ }
+
+ /**
+ * Filter the query on the copyright column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCopyright('fooValue'); // WHERE copyright = 'fooValue'
+ * $query->filterByDbCopyright('%fooValue%'); // WHERE copyright LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCopyright The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return PodcastQuery The current query, for fluid interface
+ */
+ public function filterByDbCopyright($dbCopyright = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCopyright)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCopyright)) {
+ $dbCopyright = str_replace('*', '%', $dbCopyright);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::COPYRIGHT, $dbCopyright, $comparison);
+ }
+
+ /**
+ * Filter the query on the link column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLink('fooValue'); // WHERE link = 'fooValue'
+ * $query->filterByDbLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLink The value to 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 filterByDbLink($dbLink = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLink)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLink)) {
+ $dbLink = str_replace('*', '%', $dbLink);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::LINK, $dbLink, $comparison);
+ }
+
+ /**
+ * Filter the query on the itunes_author column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbItunesAuthor('fooValue'); // WHERE itunes_author = 'fooValue'
+ * $query->filterByDbItunesAuthor('%fooValue%'); // WHERE itunes_author LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbItunesAuthor The value to 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 filterByDbItunesAuthor($dbItunesAuthor = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbItunesAuthor)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbItunesAuthor)) {
+ $dbItunesAuthor = str_replace('*', '%', $dbItunesAuthor);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::ITUNES_AUTHOR, $dbItunesAuthor, $comparison);
+ }
+
+ /**
+ * Filter the query on the itunes_keywords column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbItunesKeywords('fooValue'); // WHERE itunes_keywords = 'fooValue'
+ * $query->filterByDbItunesKeywords('%fooValue%'); // WHERE itunes_keywords LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbItunesKeywords The value to 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 filterByDbItunesKeywords($dbItunesKeywords = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbItunesKeywords)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbItunesKeywords)) {
+ $dbItunesKeywords = str_replace('*', '%', $dbItunesKeywords);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::ITUNES_KEYWORDS, $dbItunesKeywords, $comparison);
+ }
+
+ /**
+ * Filter the query on the itunes_summary column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbItunesSummary('fooValue'); // WHERE itunes_summary = 'fooValue'
+ * $query->filterByDbItunesSummary('%fooValue%'); // WHERE itunes_summary LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbItunesSummary The value to 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 filterByDbItunesSummary($dbItunesSummary = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbItunesSummary)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbItunesSummary)) {
+ $dbItunesSummary = str_replace('*', '%', $dbItunesSummary);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::ITUNES_SUMMARY, $dbItunesSummary, $comparison);
+ }
+
+ /**
+ * Filter the query on the itunes_subtitle column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbItunesSubtitle('fooValue'); // WHERE itunes_subtitle = 'fooValue'
+ * $query->filterByDbItunesSubtitle('%fooValue%'); // WHERE itunes_subtitle LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbItunesSubtitle The value to 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 filterByDbItunesSubtitle($dbItunesSubtitle = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbItunesSubtitle)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbItunesSubtitle)) {
+ $dbItunesSubtitle = str_replace('*', '%', $dbItunesSubtitle);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::ITUNES_SUBTITLE, $dbItunesSubtitle, $comparison);
+ }
+
+ /**
+ * Filter the query on the itunes_category column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbItunesCategory('fooValue'); // WHERE itunes_category = 'fooValue'
+ * $query->filterByDbItunesCategory('%fooValue%'); // WHERE itunes_category LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbItunesCategory The value to 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 filterByDbItunesCategory($dbItunesCategory = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbItunesCategory)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbItunesCategory)) {
+ $dbItunesCategory = str_replace('*', '%', $dbItunesCategory);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::ITUNES_CATEGORY, $dbItunesCategory, $comparison);
+ }
+
+ /**
+ * Filter the query on the itunes_explicit column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbItunesExplicit('fooValue'); // WHERE itunes_explicit = 'fooValue'
+ * $query->filterByDbItunesExplicit('%fooValue%'); // WHERE itunes_explicit LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbItunesExplicit The value to 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 filterByDbItunesExplicit($dbItunesExplicit = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbItunesExplicit)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbItunesExplicit)) {
+ $dbItunesExplicit = str_replace('*', '%', $dbItunesExplicit);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(PodcastPeer::ITUNES_EXPLICIT, $dbItunesExplicit, $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 StationPodcast object
+ *
+ * @param StationPodcast|PropelObjectCollection $stationPodcast 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 filterByStationPodcast($stationPodcast, $comparison = null)
+ {
+ if ($stationPodcast instanceof StationPodcast) {
+ return $this
+ ->addUsingAlias(PodcastPeer::ID, $stationPodcast->getDbPodcastId(), $comparison);
+ } elseif ($stationPodcast instanceof PropelObjectCollection) {
+ return $this
+ ->useStationPodcastQuery()
+ ->filterByPrimaryKeys($stationPodcast->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByStationPodcast() only accepts arguments of type StationPodcast or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the StationPodcast 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 joinStationPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('StationPodcast');
+
+ // 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, 'StationPodcast');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the StationPodcast relation StationPodcast 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 StationPodcastQuery A secondary query class using the current class as primary query
+ */
+ public function useStationPodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinStationPodcast($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'StationPodcast', 'StationPodcastQuery');
+ }
+
+ /**
+ * Filter the query by a related ImportedPodcast object
+ *
+ * @param ImportedPodcast|PropelObjectCollection $importedPodcast 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 filterByImportedPodcast($importedPodcast, $comparison = null)
+ {
+ if ($importedPodcast instanceof ImportedPodcast) {
+ return $this
+ ->addUsingAlias(PodcastPeer::ID, $importedPodcast->getDbPodcastId(), $comparison);
+ } elseif ($importedPodcast instanceof PropelObjectCollection) {
+ return $this
+ ->useImportedPodcastQuery()
+ ->filterByPrimaryKeys($importedPodcast->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByImportedPodcast() only accepts arguments of type ImportedPodcast or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ImportedPodcast 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 joinImportedPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ImportedPodcast');
+
+ // 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, 'ImportedPodcast');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ImportedPodcast relation ImportedPodcast 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 ImportedPodcastQuery A secondary query class using the current class as primary query
+ */
+ public function useImportedPodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinImportedPodcast($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ImportedPodcast', 'ImportedPodcastQuery');
+ }
+
+ /**
+ * Filter the query by a related PodcastEpisodes object
+ *
+ * @param PodcastEpisodes|PropelObjectCollection $podcastEpisodes 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 filterByPodcastEpisodes($podcastEpisodes, $comparison = null)
+ {
+ if ($podcastEpisodes instanceof PodcastEpisodes) {
+ return $this
+ ->addUsingAlias(PodcastPeer::ID, $podcastEpisodes->getDbPodcastId(), $comparison);
+ } elseif ($podcastEpisodes instanceof PropelObjectCollection) {
+ return $this
+ ->usePodcastEpisodesQuery()
+ ->filterByPrimaryKeys($podcastEpisodes->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByPodcastEpisodes() only accepts arguments of type PodcastEpisodes or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the PodcastEpisodes 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 joinPodcastEpisodes($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('PodcastEpisodes');
+
+ // 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, 'PodcastEpisodes');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the PodcastEpisodes relation PodcastEpisodes 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 PodcastEpisodesQuery A secondary query class using the current class as primary query
+ */
+ public function usePodcastEpisodesQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinPodcastEpisodes($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'PodcastEpisodes', 'PodcastEpisodesQuery');
+ }
+
+ /**
+ * 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/models/airtime/om/BaseStationPodcast.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcast.php
new file mode 100644
index 000000000..5da81df34
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcast.php
@@ -0,0 +1,959 @@
+id;
+ }
+
+ /**
+ * Get the [podcast_id] column value.
+ *
+ * @return int
+ */
+ public function getDbPodcastId()
+ {
+
+ return $this->podcast_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return StationPodcast 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[] = StationPodcastPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [podcast_id] column.
+ *
+ * @param int $v new value
+ * @return StationPodcast 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[] = StationPodcastPeer::PODCAST_ID;
+ }
+
+ if ($this->aPodcast !== null && $this->aPodcast->getDbId() !== $v) {
+ $this->aPodcast = null;
+ }
+
+
+ return $this;
+ } // setDbPodcastId()
+
+ /**
+ * 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->podcast_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 2; // 2 = StationPodcastPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating StationPodcast 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->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(StationPodcastPeer::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 = StationPodcastPeer::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->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(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = StationPodcastQuery::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(StationPodcastPeer::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);
+ StationPodcastPeer::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->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[] = StationPodcastPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . StationPodcastPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('station_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(StationPodcastPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(StationPodcastPeer::PODCAST_ID)) {
+ $modifiedColumns[':p' . $index++] = '"podcast_id"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "station_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 '"podcast_id"':
+ $stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ }
+
+ $this->validationFailures = $res;
+
+ return false;
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggregated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aPodcast !== null) {
+ if (!$this->aPodcast->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aPodcast->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = StationPodcastPeer::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 = StationPodcastPeer::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->getDbPodcastId();
+ 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['StationPodcast'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['StationPodcast'][$this->getPrimaryKey()] = true;
+ $keys = StationPodcastPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbPodcastId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ 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 = StationPodcastPeer::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->setDbPodcastId($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 = StationPodcastPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbPodcastId($arr[$keys[1]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(StationPodcastPeer::ID)) $criteria->add(StationPodcastPeer::ID, $this->id);
+ if ($this->isColumnModified(StationPodcastPeer::PODCAST_ID)) $criteria->add(StationPodcastPeer::PODCAST_ID, $this->podcast_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME);
+ $criteria->add(StationPodcastPeer::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 StationPodcast (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->setDbPodcastId($this->getDbPodcastId());
+
+ 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 StationPodcast 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 StationPodcastPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new StationPodcastPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Podcast object.
+ *
+ * @param Podcast $v
+ * @return StationPodcast 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->addStationPodcast($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->addStationPodcasts($this);
+ */
+ }
+
+ return $this->aPodcast;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->podcast_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aPodcast instanceof Persistent) {
+ $this->aPodcast->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aPodcast = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(StationPodcastPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+
+ // delegate behavior
+
+ if (is_callable(array('Podcast', $name))) {
+ if (!$delegate = $this->getPodcast()) {
+ $delegate = new Podcast();
+ $this->setPodcast($delegate);
+ }
+
+ return call_user_func_array(array($delegate, $name), $params);
+ }
+
+ return parent::__call($name, $params);
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php
new file mode 100644
index 000000000..85adc56ee
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php
@@ -0,0 +1,999 @@
+ array ('DbId', 'DbPodcastId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPodcastId', ),
+ BasePeer::TYPE_COLNAME => array (StationPodcastPeer::ID, StationPodcastPeer::PODCAST_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PODCAST_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'podcast_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. StationPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPodcastId' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPodcastId' => 1, ),
+ BasePeer::TYPE_COLNAME => array (StationPodcastPeer::ID => 0, StationPodcastPeer::PODCAST_ID => 1, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PODCAST_ID' => 1, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'podcast_id' => 1, ),
+ BasePeer::TYPE_NUM => array (0, 1, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = StationPodcastPeer::getFieldNames($toType);
+ $key = isset(StationPodcastPeer::$fieldKeys[$fromType][$name]) ? StationPodcastPeer::$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(StationPodcastPeer::$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, StationPodcastPeer::$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 StationPodcastPeer::$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. StationPodcastPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(StationPodcastPeer::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(StationPodcastPeer::ID);
+ $criteria->addSelectColumn(StationPodcastPeer::PODCAST_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.podcast_id');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ StationPodcastPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(StationPodcastPeer::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 StationPodcast
+ * @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 = StationPodcastPeer::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 StationPodcastPeer::populateObjects(StationPodcastPeer::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(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ StationPodcastPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(StationPodcastPeer::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 StationPodcast $obj A StationPodcast 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
+ StationPodcastPeer::$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 StationPodcast 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 StationPodcast) {
+ $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 StationPodcast object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(StationPodcastPeer::$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 StationPodcast 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(StationPodcastPeer::$instances[$key])) {
+ return StationPodcastPeer::$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 (StationPodcastPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ StationPodcastPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to station_podcast
+ * 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 = StationPodcastPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = StationPodcastPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = StationPodcastPeer::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;
+ StationPodcastPeer::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 (StationPodcast object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = StationPodcastPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = StationPodcastPeer::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 + StationPodcastPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = StationPodcastPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ StationPodcastPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * 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(StationPodcastPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ StationPodcastPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(StationPodcastPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(StationPodcastPeer::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 StationPodcast 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 StationPodcast 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(StationPodcastPeer::DATABASE_NAME);
+ }
+
+ StationPodcastPeer::addSelectColumns($criteria);
+ $startcol = StationPodcastPeer::NUM_HYDRATE_COLUMNS;
+ PodcastPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(StationPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = StationPodcastPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = StationPodcastPeer::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 = StationPodcastPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ StationPodcastPeer::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 (StationPodcast) to $obj2 (Podcast)
+ $obj2->addStationPodcast($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(StationPodcastPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ StationPodcastPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(StationPodcastPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(StationPodcastPeer::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 StationPodcast 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 StationPodcast 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(StationPodcastPeer::DATABASE_NAME);
+ }
+
+ StationPodcastPeer::addSelectColumns($criteria);
+ $startcol2 = StationPodcastPeer::NUM_HYDRATE_COLUMNS;
+
+ PodcastPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(StationPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = StationPodcastPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = StationPodcastPeer::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 = StationPodcastPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ StationPodcastPeer::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 loaded
+
+ // Add the $obj1 (StationPodcast) to the collection in $obj2 (Podcast)
+ $obj2->addStationPodcast($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(StationPodcastPeer::DATABASE_NAME)->getTable(StationPodcastPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseStationPodcastPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseStationPodcastPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \StationPodcastTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return StationPodcastPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a StationPodcast or Criteria object.
+ *
+ * @param mixed $values Criteria or StationPodcast 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(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from StationPodcast object
+ }
+
+ if ($criteria->containsKey(StationPodcastPeer::ID) && $criteria->keyContainsValue(StationPodcastPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.StationPodcastPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(StationPodcastPeer::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 StationPodcast or Criteria object.
+ *
+ * @param mixed $values Criteria or StationPodcast 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(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(StationPodcastPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(StationPodcastPeer::ID);
+ $value = $criteria->remove(StationPodcastPeer::ID);
+ if ($value) {
+ $selectCriteria->add(StationPodcastPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME);
+ }
+
+ } else { // $values is StationPodcast object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(StationPodcastPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the station_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(StationPodcastPeer::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(StationPodcastPeer::TABLE_NAME, $con, StationPodcastPeer::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).
+ StationPodcastPeer::clearInstancePool();
+ StationPodcastPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a StationPodcast or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or StationPodcast 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(StationPodcastPeer::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.
+ StationPodcastPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof StationPodcast) { // it's a model object
+ // invalidate the cache for this single object
+ StationPodcastPeer::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(StationPodcastPeer::DATABASE_NAME);
+ $criteria->add(StationPodcastPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ StationPodcastPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(StationPodcastPeer::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);
+ StationPodcastPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given StationPodcast 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 StationPodcast $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(StationPodcastPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(StationPodcastPeer::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(StationPodcastPeer::DATABASE_NAME, StationPodcastPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return StationPodcast
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = StationPodcastPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME);
+ $criteria->add(StationPodcastPeer::ID, $pk);
+
+ $v = StationPodcastPeer::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 StationPodcast[]
+ * @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(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME);
+ $criteria->add(StationPodcastPeer::ID, $pks, Criteria::IN);
+ $objs = StationPodcastPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
+
+} // BaseStationPodcastPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseStationPodcastPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php
new file mode 100644
index 000000000..17851695d
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php
@@ -0,0 +1,404 @@
+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 StationPodcast|StationPodcast[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = StationPodcastPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(StationPodcastPeer::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 StationPodcast 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 StationPodcast A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "podcast_id" FROM "station_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 StationPodcast();
+ $obj->hydrate($row);
+ StationPodcastPeer::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 StationPodcast|StationPodcast[]|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|StationPodcast[]|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 StationPodcastQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(StationPodcastPeer::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 StationPodcastQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(StationPodcastPeer::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 StationPodcastQuery 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(StationPodcastPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(StationPodcastPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(StationPodcastPeer::ID, $dbId, $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 StationPodcastQuery 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(StationPodcastPeer::PODCAST_ID, $dbPodcastId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPodcastId['max'])) {
+ $this->addUsingAlias(StationPodcastPeer::PODCAST_ID, $dbPodcastId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(StationPodcastPeer::PODCAST_ID, $dbPodcastId, $comparison);
+ }
+
+ /**
+ * 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 StationPodcastQuery 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(StationPodcastPeer::PODCAST_ID, $podcast->getDbId(), $comparison);
+ } elseif ($podcast instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(StationPodcastPeer::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 StationPodcastQuery 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 StationPodcast $stationPodcast Object to remove from the list of results
+ *
+ * @return StationPodcastQuery The current query, for fluid interface
+ */
+ public function prune($stationPodcast = null)
+ {
+ if ($stationPodcast) {
+ $this->addUsingAlias(StationPodcastPeer::ID, $stationPodcast->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/modules/rest/Bootstrap.php b/airtime_mvc/application/modules/rest/Bootstrap.php
index af4f0ba98..016c94017 100644
--- a/airtime_mvc/application/modules/rest/Bootstrap.php
+++ b/airtime_mvc/application/modules/rest/Bootstrap.php
@@ -1,5 +1,7 @@
getRouter();
$restRoute = new Zend_Rest_Route($front, array(), array(
- 'rest'=> array('media', 'show-image')));
+ 'rest'=> array('media', 'show-image', 'podcast', 'podcast-episodes')));
assert($router->addRoute('rest', $restRoute));
+ $podcastBulkRoute = new Zend_Controller_Router_Route(
+ 'rest/podcast/bulk',
+ array(
+ 'controller' => 'podcast',
+ 'action' => 'bulk',
+ 'module' => 'rest'
+ )
+ );
+ $router->addRoute('podcast-bulk', $podcastBulkRoute);
+
+ $stationPodcastRoute = new Zend_Controller_Router_Route(
+ 'rest/podcast/station',
+ array(
+ 'controller' => 'podcast',
+ 'action' => 'station',
+ 'module' => 'rest'
+ )
+ );
+ $router->addRoute('station-podcast', $stationPodcastRoute);
+
+ $route = new Rest_RouteController($front,
+ 'rest/podcast/:id/episodes',
+ array(
+ 'controller' => 'podcast-episodes',
+ 'module' => 'rest'
+ ),
+ array(
+ 'id' => '\d+'
+ )
+ );
+ $router->addRoute('podcast-episodes-index', $route);
+
+ $route = new Rest_RouteController($front,
+ 'rest/podcast/:id/episodes/:episode_id',
+ array(
+ 'controller' => 'podcast-episodes',
+ 'module' => 'rest'
+ ),
+ array(
+ 'id' => '\d+',
+ 'episode_id' => '\d+'
+ )
+ );
+ $router->addRoute('podcast-episodes', $route);
+
/** MediaController Routes **/
$downloadRoute = new Zend_Controller_Router_Route(
'rest/media/:id/download',
@@ -25,6 +72,21 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
);
$router->addRoute('download', $downloadRoute);
+ $podcastEpisodeDownloadRoute = new Zend_Controller_Router_Route_Regex(
+ 'rest/media/(?