Merge branch 'saas-dev' into saas-dev-facebook-radio
This commit is contained in:
commit
25c54ce974
|
@ -4,7 +4,7 @@
|
|||
vendor/*
|
||||
composer.phar
|
||||
*~$
|
||||
*log.*
|
||||
*\.log.*
|
||||
**/*.egg-info/*
|
||||
**/build/*
|
||||
**/dist/*
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
<?php
|
||||
|
||||
require_once "CeleryServiceFactory.php";
|
||||
|
||||
class CeleryService {
|
||||
class CeleryManager {
|
||||
|
||||
/**
|
||||
* @var int milliseconds (for compatibility with celery) until we consider a message to have timed out
|
||||
*/
|
||||
private static $_CELERY_MESSAGE_TIMEOUT = 600000; // 10 minutes
|
||||
private static $_CELERY_MESSAGE_TIMEOUT = 900000; // 15 minutes
|
||||
|
||||
/**
|
||||
* We have to use celeryresults (the default results exchange) because php-celery
|
||||
|
@ -17,6 +15,11 @@ class CeleryService {
|
|||
*/
|
||||
private static $_CELERY_RESULTS_EXCHANGE = 'celeryresults';
|
||||
|
||||
/**
|
||||
* @var PropelCollection cache of any pending CeleryTasks results for a service or task
|
||||
*/
|
||||
private static $_pendingTasks;
|
||||
|
||||
/**
|
||||
* Connect to the Celery daemon via amqp
|
||||
*
|
||||
|
@ -77,10 +80,9 @@ class CeleryService {
|
|||
$c = self::_setupCeleryExchange($config, self::$_CELERY_RESULTS_EXCHANGE, $queue);
|
||||
$message = $c->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);
|
||||
}
|
||||
|
||||
/**
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
class PodcastManager {
|
||||
|
||||
/**
|
||||
* @var int how often, in seconds, to check for and ingest new podcast episodes
|
||||
*/
|
||||
private static $_PODCAST_POLL_INTERVAL_SECONDS = 3600; // 1 hour
|
||||
|
||||
/**
|
||||
* Check whether $_PODCAST_POLL_INTERVAL_SECONDS have passed since the last call to
|
||||
* downloadNewestEpisodes
|
||||
*
|
||||
* @return bool true if $_PODCAST_POLL_INTERVAL_SECONDS has passed since the last check
|
||||
*/
|
||||
public static function hasPodcastPollIntervalPassed() {
|
||||
$lastPolled = Application_Model_Preference::getPodcastPollLock();
|
||||
return empty($lastPolled) || (microtime(true) > $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
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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]();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Basic enumeration implementation; from http://stackoverflow.com/questions/254514/php-and-enumerations
|
||||
*
|
||||
* Class Enum
|
||||
*/
|
||||
abstract class Enum {
|
||||
|
||||
const __default = NULL;
|
||||
private static $constCacheArray = NULL;
|
||||
|
||||
private function __construct() {}
|
||||
|
||||
private static function getConstants() {
|
||||
if (self::$constCacheArray == NULL) {
|
||||
self::$constCacheArray = [];
|
||||
}
|
||||
$calledClass = get_called_class();
|
||||
if (!array_key_exists($calledClass, self::$constCacheArray)) {
|
||||
$reflect = new ReflectionClass($calledClass);
|
||||
self::$constCacheArray[$calledClass] = $reflect->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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
final class HttpRequestType extends Enum {
|
||||
|
||||
const GET = "GET";
|
||||
const POST = "POST";
|
||||
const PUT = "PUT";
|
||||
const DELETE = "DELETE";
|
||||
const PATCH = "PATCH";
|
||||
const OPTIONS = "OPTIONS";
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
require_once "Enum.php";
|
||||
final class MediaType extends Enum {
|
||||
|
||||
const __default = self::FILE;
|
||||
|
||||
const FILE = 1;
|
||||
const PLAYLIST = 2;
|
||||
const BLOCK = 3;
|
||||
const WEBSTREAM = 4;
|
||||
const PODCAST = 5;
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
interface OAuth2Controller {
|
||||
|
||||
/**
|
||||
* Send user to a third-party service to authorize before being redirected
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function authorizeAction();
|
||||
|
||||
/**
|
||||
* Clear the previously saved request token from the preferences
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deauthorizeAction();
|
||||
|
||||
/**
|
||||
* Called when user successfully completes third-party authorization
|
||||
* Store the returned request token for future requests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function redirectAction();
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
interface Publish {
|
||||
|
||||
/**
|
||||
* Publish the file with the given file ID
|
||||
*
|
||||
* @param int $fileId ID of the file to be published
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function publish($fileId);
|
||||
|
||||
/**
|
||||
* Unpublish the file with the given file ID
|
||||
*
|
||||
* @param int $fileId ID of the file to be unpublished
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unpublish($fileId);
|
||||
|
||||
|
||||
/**
|
||||
* Fetch the publication status for the file with the given ID
|
||||
*
|
||||
* @param int $fileId the ID of the file to check
|
||||
*
|
||||
* @return int 1 if the file has been published,
|
||||
* 0 if the file has yet to be published,
|
||||
* -1 if the file is in a pending state,
|
||||
* 2 if the source is unreachable (disconnected)
|
||||
*/
|
||||
public function getPublishStatus($fileId);
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: asantoni
|
||||
* Date: 11/09/15
|
||||
* Time: 2:47 PM
|
||||
*/
|
||||
|
||||
class AirtimeTableView {
|
||||
|
||||
private static function _getTableJavaScriptDependencies() {
|
||||
return ['js/airtime/widgets/table.js',
|
||||
'js/datatables/js/jquery.dataTables.js',
|
||||
'js/datatables/plugin/dataTables.pluginAPI.js',
|
||||
'js/datatables/plugin/dataTables.fnSetFilteringDelay.js',
|
||||
'js/datatables/plugin/dataTables.ColVis.js',
|
||||
'js/datatables/plugin/dataTables.colReorder.min.js?',
|
||||
'js/datatables/plugin/dataTables.FixedColumns.js',
|
||||
'js/datatables/plugin/dataTables.FixedHeader.js',
|
||||
'js/datatables/plugin/dataTables.columnFilter.js?'];
|
||||
}
|
||||
|
||||
public static function injectTableJavaScriptDependencies(&$headScript, $baseUrl, $airtimeVersion)
|
||||
{
|
||||
$deps = self::_getTableJavaScriptDependencies();
|
||||
for ($i = 0; $i < count($deps); $i++) {
|
||||
$headScript->appendFile($baseUrl . $deps[$i] .'?'. $airtimeVersion, 'text/javascript');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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')
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
* the navigation container below.
|
||||
*/
|
||||
$pages = array(
|
||||
array(
|
||||
'label' => "<i class='icon-music icon-white'></i>"._('My Podcast'),
|
||||
'module' => 'default',
|
||||
'controller' => 'podcast',
|
||||
'action' => 'station',
|
||||
'resource' => 'podcast'
|
||||
),
|
||||
array(
|
||||
'label' => "<i class='icon-globe icon-white'></i>"._('Radio Page'),
|
||||
'uri' => '/',
|
||||
|
|
|
@ -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<br>");
|
||||
flush();
|
||||
ob_flush();
|
||||
//while(@ob_end_clean());
|
||||
$scheduler->removeGaps2($instance->getDbId());
|
||||
$progress += 1;
|
||||
}
|
||||
echo("Recalculated $total shows.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once(__DIR__.'/../common/widgets/Table.php');
|
||||
|
||||
class DashboardController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
|
@ -99,11 +101,7 @@ class DashboardController extends Zend_Controller_Action
|
|||
$this->_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']);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
class FeedsController extends Zend_Controller_Action
|
||||
{
|
||||
public function stationRssAction()
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -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!
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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?"),
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
class PodcastController extends Zend_Controller_Action {
|
||||
|
||||
public function init() {
|
||||
$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/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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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 = "<div class='success'>". _("Preferences updated.")."</div>";
|
||||
$form = new Application_Form_Preferences();
|
||||
|
@ -83,6 +85,28 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
public function stationPodcastSettingsAction() {
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$values = json_decode($this->getRequest()->getRawBody());
|
||||
|
||||
if (!Application_Model_Preference::getStationPodcastPrivacy() && $values->stationPodcastPrivacy == 1) {
|
||||
// Refresh the download key when enabling privacy
|
||||
Application_Model_Preference::setStationPodcastDownloadKey();
|
||||
}
|
||||
|
||||
// Append sharing token (download key) to Station podcast URL
|
||||
$stationPodcast = PodcastQuery::create()->findOneByDbId(Application_Model_Preference::getStationPodcastId());
|
||||
$key = Application_Model_Preference::getStationPodcastDownloadKey();
|
||||
$url = Application_Common_HTTPHelper::getStationUrl() .
|
||||
(((int) $values->stationPodcastPrivacy) ? "feeds/station-rss?sharing_token=$key" : "feeds/station-rss");
|
||||
$stationPodcast->setDbUrl($url)->save();
|
||||
Application_Model_Preference::setStationPodcastPrivacy($values->stationPodcastPrivacy);
|
||||
|
||||
$this->_helper->json->sendJson(array("url" => $url));
|
||||
}
|
||||
|
||||
public function supportSettingAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
class RenderController extends Zend_Controller_Action {
|
||||
|
||||
public function init() {
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||
$csrf_element = new Zend_Form_Element_Hidden('csrf_token');
|
||||
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
|
||||
$this->view->csrf = $csrf_element;
|
||||
}
|
||||
|
||||
public function podcastUrlDialogAction() {
|
||||
$path = 'podcast/podcast_url_dialog.phtml';
|
||||
$this->_helper->json->sendJson(array("html"=>$this->view->render($path)));
|
||||
}
|
||||
|
||||
}
|
|
@ -90,13 +90,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
//Start Show builder JS/CSS requirements
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.colReorder.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$headScript = $this->view->headScript();
|
||||
AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/libs/moment.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/libs/moment-timezone-with-data-2010-2020.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
|
|
@ -32,14 +32,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.colReorder.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedHeader.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -51,23 +43,28 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$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');
|
||||
$headScript = $this->view->headScript();
|
||||
AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
|
||||
|
||||
// PLUPLOAD
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/tabs.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
// MEDIA BUILDER
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/js-timezone-detect/jstz-1.0.4.min.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.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->headScript()->appendFile($baseUrl.'js/airtime/library/publish.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/dashboard.css?'.$CC_CONFIG['airtime_version']); // TODO
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/dashboard.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
||||
|
|
|
@ -3,32 +3,110 @@
|
|||
require_once "ThirdPartyController.php";
|
||||
require_once "ise/php-soundcloud/src/Soundcloud/Service.php";
|
||||
|
||||
class SoundcloudController extends ThirdPartyController {
|
||||
class SoundcloudController extends ThirdPartyController implements OAuth2Controller {
|
||||
|
||||
/**
|
||||
* @var SoundcloudService
|
||||
* @var Application_Service_SoundcloudService
|
||||
*/
|
||||
protected $_service;
|
||||
|
||||
/**
|
||||
* @var string Application_Model_Preference service request token accessor function name
|
||||
*/
|
||||
protected $_SERVICE_TOKEN_ACCESSOR = 'setSoundCloudRequestToken';
|
||||
|
||||
/**
|
||||
* Set up SoundCloud access variables.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
parent::init();
|
||||
$this->_service = new SoundcloudService();
|
||||
$this->_service = new Application_Service_SoundcloudService();
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the file with the given id to SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if upload fails for any reason
|
||||
*/
|
||||
public function uploadAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->upload($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the file with the given id on SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if upload fails for any reason
|
||||
*/
|
||||
public function updateAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->update($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the file with the given id from SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if download fails for any reason
|
||||
*/
|
||||
public function downloadAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->download($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the file with the given id from SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if deletion fails for any reason
|
||||
*/
|
||||
public function deleteAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send user to SoundCloud to authorize before being redirected
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function authorizeAction() {
|
||||
$auth_url = $this->_service->getAuthorizeUrl();
|
||||
header('Location: ' . $auth_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the previously saved request token from preferences
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deauthorizeAction() {
|
||||
Application_Model_Preference::setSoundCloudRequestToken("");
|
||||
header('Location: ' . $this->_baseUrl . 'preference'); // Redirect back to the preference page
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when user successfully completes SoundCloud authorization
|
||||
* Store the returned request token for future requests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function redirectAction() {
|
||||
$code = $_GET['code'];
|
||||
$this->_service->requestNewAccessToken($code);
|
||||
header('Location: ' . $this->_baseUrl . 'preference'); // Redirect back to the preference page
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the permalink to a file on SoundCloud and redirect to it.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function viewOnSoundCloudAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
try {
|
||||
$soundcloudLink = $this->_service->getLinkToFile($id);
|
||||
header('Location: ' . $soundcloudLink);
|
||||
|
|
|
@ -11,83 +11,20 @@ abstract class ThirdPartyController extends Zend_Controller_Action {
|
|||
protected $_baseUrl;
|
||||
|
||||
/**
|
||||
* @var ThirdPartyService third party service object
|
||||
* @var Application_Service_ThirdPartyService third party service object
|
||||
*/
|
||||
protected $_service;
|
||||
|
||||
/**
|
||||
* @var string Application_Model_Preference service request token accessor function name
|
||||
*/
|
||||
protected $_SERVICE_TOKEN_ACCESSOR;
|
||||
|
||||
/**
|
||||
* Disable controller rendering and initialize
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$this->_baseUrl = 'http://' . $CC_CONFIG['baseUrl'] . ":" . $CC_CONFIG['basePort'] . "/";
|
||||
$this->_baseUrl = Application_Common_HTTPHelper::getStationUrl();
|
||||
|
||||
$this->view->layout()->disableLayout(); // Don't inject the standard Now Playing header.
|
||||
$this->_helper->viewRenderer->setNoRender(true); // Don't use (phtml) templates
|
||||
}
|
||||
|
||||
/**
|
||||
* Send user to a third-party service to authorize before being redirected
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function authorizeAction() {
|
||||
$auth_url = $this->_service->getAuthorizeUrl();
|
||||
header('Location: ' . $auth_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the previously saved request token from the preferences
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deauthorizeAction() {
|
||||
$function = $this->_SERVICE_TOKEN_ACCESSOR;
|
||||
Application_Model_Preference::$function("");
|
||||
header('Location: ' . $this->_baseUrl . 'preference'); // Redirect back to the preference page
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when user successfully completes third-party authorization
|
||||
* Store the returned request token for future requests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function redirectAction() {
|
||||
$code = $_GET['code'];
|
||||
$this->_service->requestNewAccessToken($code);
|
||||
header('Location: ' . $this->_baseUrl . 'preference'); // Redirect back to the preference page
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the file with the given id to a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if upload fails for any reason
|
||||
*/
|
||||
public function uploadAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->upload($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the file with the given id from a third-party service
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if deletion fails for any reason
|
||||
*/
|
||||
public function deleteAction() {
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$this->_service->delete($id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
|
|
@ -0,0 +1,11 @@
|
|||
ALTER TABLE cc_files DROP COLUMN description;
|
||||
|
||||
DELETE FROM cc_pref WHERE keystr = 'station_podcast_id';
|
||||
|
||||
DROP TABLE IF EXISTS "podcast" CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS "imported_podcast" CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS "station_podcast" CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS "podcast_episodes" CASCADE;
|
|
@ -120,7 +120,8 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
"upgrade",
|
||||
'whmcs-login',
|
||||
"provisioning",
|
||||
"embed"
|
||||
"embed",
|
||||
"feeds"
|
||||
)))
|
||||
{
|
||||
$this->setRoleName("G");
|
||||
|
@ -174,6 +175,12 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
// we need to check the CSRF token
|
||||
if ($_SERVER['REQUEST_METHOD'] != "GET" && $request->getModuleName() == "rest") {
|
||||
$token = $request->getParam("csrf_token");
|
||||
// PUT requests don't parameterize the data in the body, so we can't
|
||||
// fetch it with getParam or getPost; instead we have to parse the body and
|
||||
// check for the token in the JSON. (Hopefully we can find a better way to do this) -- Duncan
|
||||
if (empty($token)) {
|
||||
$token = json_decode($this->getRequest()->getRawBody(), true)["csrf_token"];
|
||||
}
|
||||
$tokenValid = $this->verifyCSRFToken($token);
|
||||
|
||||
if (!$tokenValid) {
|
||||
|
@ -205,18 +212,18 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
/** Check if the controller/action can be accessed by the current user */
|
||||
if (!$this->getAcl()->has($resourceName)
|
||||
|| !$this->getAcl()->isAllowed($this->_roleName,
|
||||
|| !$this->getAcl()->isAllowed($this->_roleName,
|
||||
$resourceName,
|
||||
$request->getActionName())) {
|
||||
/** Redirect to access denied page */
|
||||
$this->setErrorPage('error403');
|
||||
$this->denyAccess(); /* This results in a 404! */
|
||||
$this->denyAccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function verifyAuth() {
|
||||
if ($this->verifyAPIKey()) {
|
||||
if ($this->verifyAPIKey() || $this->isVerifiedDownload()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -226,7 +233,30 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the requested file can be downloaded.
|
||||
* It should satisfy the following requirements:
|
||||
* * request path is /rest/media/:id/download
|
||||
* * download key is correct
|
||||
* * requested file belongs to the station podcast
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isVerifiedDownload() {
|
||||
$request = $this->getRequest();
|
||||
$fileId = $request->getParam("id");
|
||||
$key = $request->getParam("download_key");
|
||||
$module = $request->getModuleName();
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
$stationPodcast = StationPodcastQuery::create()
|
||||
->findOneByDbPodcastId(Application_Model_Preference::getStationPodcastId());
|
||||
return $module == "rest" && $controller == "media" && $action == "download"
|
||||
&& $key === Application_Model_Preference::getStationPodcastDownloadKey()
|
||||
&& $stationPodcast->hasEpisodeForFile($fileId);
|
||||
}
|
||||
|
||||
private function verifyCSRFToken($token) {
|
||||
return SecurityHelper::verifyCSRFToken($token);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
"upgrade",
|
||||
'whmcs-login',
|
||||
"provisioning",
|
||||
"embed"
|
||||
"embed",
|
||||
"feeds"
|
||||
))
|
||||
) {
|
||||
//Start the session
|
||||
|
@ -54,6 +55,24 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
$this->_initTranslationGlobals();
|
||||
$this->_initViewHelpers();
|
||||
}
|
||||
|
||||
// Skip upgrades and task management when running unit tests
|
||||
if (getenv("AIRTIME_UNIT_TEST") != 1) {
|
||||
$taskManager = TaskManager::getInstance();
|
||||
|
||||
// Run the upgrade on each request (if it needs to be run)
|
||||
// We can't afford to wait 7 minutes to run an upgrade: users could
|
||||
// have several minutes of database errors while waiting for a
|
||||
// schema change upgrade to happen after a deployment
|
||||
$taskManager->runTask(TaskFactory::UPGRADE);
|
||||
|
||||
// Piggyback the TaskManager onto API calls. This provides guaranteed consistency
|
||||
// (there is at least one API call made from pypo to Airtime every 7 minutes) and
|
||||
// greatly reduces the chances of lock contention on cc_pref while the TaskManager runs
|
||||
if ($controller == "api") {
|
||||
$taskManager->runTasks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function _initGlobals()
|
||||
|
@ -157,6 +176,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
$view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/libs/jquery-ui-1.8.24.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/libs/angular.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/bootstrap/bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/libs/underscore-min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP NOT NULL;
|
|
@ -0,0 +1,90 @@
|
|||
ALTER TABLE cc_files ADD COLUMN description VARCHAR(512);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"url" VARCHAR(4096) NOT NULL,
|
||||
"title" VARCHAR(4096) NOT NULL,
|
||||
"creator" VARCHAR(4096),
|
||||
"description" VARCHAR(4096),
|
||||
"language" VARCHAR(4096),
|
||||
"copyright" VARCHAR(4096),
|
||||
"link" VARCHAR(4096),
|
||||
"itunes_author" VARCHAR(4096),
|
||||
"itunes_keywords" VARCHAR(4096),
|
||||
"itunes_summary" VARCHAR(4096),
|
||||
"itunes_subtitle" VARCHAR(4096),
|
||||
"itunes_category" VARCHAR(4096),
|
||||
"itunes_explicit" VARCHAR(4096),
|
||||
"owner" INTEGER,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- station_podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "station_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- imported_podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "imported_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"auto_ingest_timestamp" TIMESTAMP,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast_episodes
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "podcast_episodes"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
"publication_date" TIMESTAMP NOT NULL,
|
||||
"download_url" VARCHAR(4096) NOT NULL,
|
||||
"episode_guid" VARCHAR(4096) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "podcast" ADD CONSTRAINT "podcast_owner_fkey"
|
||||
FOREIGN KEY ("owner")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "station_podcast" ADD CONSTRAINT "podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "imported_podcast" ADD CONSTRAINT "podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_cc_files_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
|
@ -48,6 +48,16 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
));
|
||||
$this->addElement($album_title);
|
||||
|
||||
// Description field
|
||||
$description = new Zend_Form_Element_Textarea('description');
|
||||
$description->class = 'input_text';
|
||||
$description->setLabel(_('Description:'))
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
new Zend_Validate_StringLength(array('max' => 512))
|
||||
));
|
||||
$this->addElement($description);
|
||||
|
||||
// Add track number field
|
||||
$track_number = new Zend_Form_Element('track_number');
|
||||
$track_number->class = 'input_text';
|
||||
|
@ -189,27 +199,37 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
$cueOut->setValidators(array($cueOutValidator));
|
||||
$this->addElement($cueOut);
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('button', 'editmdsave', array(
|
||||
'ignore' => true,
|
||||
'class' => 'btn md-save right-floated',
|
||||
'label' => _('OK'),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
// Add the cancel button
|
||||
$this->addElement('button', 'editmdcancel', array(
|
||||
'ignore' => true,
|
||||
'class' => 'btn md-cancel right-floated',
|
||||
'class' => 'btn md-cancel',
|
||||
'label' => _('Cancel'),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addDisplayGroup(array('editmdcancel', 'editmdsave'), 'submitButtons', array(
|
||||
// Add the submit button
|
||||
$this->addElement('button', 'editmdsave', array(
|
||||
'ignore' => true,
|
||||
'class' => 'btn md-save',
|
||||
'label' => _('Save'),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Button to open the publish dialog
|
||||
$this->addElement('button', 'publishdialog', array(
|
||||
'ignore' => true,
|
||||
'class' => 'btn md-publish',
|
||||
'label' => _('Publish...'),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addDisplayGroup(array('publishdialog', 'editmdsave', 'editmdcancel'), 'submitButtons', array(
|
||||
'decorators' => array(
|
||||
'FormElements',
|
||||
'DtDdWrapper'
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_PodcastPreferences extends Zend_Form_SubForm {
|
||||
|
||||
public function init() {
|
||||
$isPrivate = Application_Model_Preference::getStationPodcastPrivacy();
|
||||
$stationPodcastPrivacy = new Zend_Form_Element_Radio("stationPodcastPrivacy");
|
||||
$stationPodcastPrivacy->setLabel(_('Feed Privacy'));
|
||||
$stationPodcastPrivacy->setMultiOptions(array(
|
||||
_("Public"),
|
||||
_("Private"),
|
||||
));
|
||||
$stationPodcastPrivacy->setSeparator(' ');
|
||||
$stationPodcastPrivacy->addDecorator('HtmlTag', array('tag' => 'dd',
|
||||
'id'=>"stationPodcastPrivacy-element",
|
||||
'class' => 'radio-inline-list',
|
||||
));
|
||||
$stationPodcastPrivacy->setValue($isPrivate);
|
||||
$this->addElement($stationPodcastPrivacy);
|
||||
|
||||
$stationPodcast = PodcastQuery::create()->findOneByDbId(Application_Model_Preference::getStationPodcastId());
|
||||
$url = $stationPodcast->getDbUrl();
|
||||
$feedUrl = new Zend_Form_Element_Text("stationPodcastFeedUrl");
|
||||
$feedUrl->setAttrib('class', 'input_text')
|
||||
->setAttrib('disabled', 'disabled')
|
||||
->setRequired(false)
|
||||
->setLabel(_("Feed URL"))
|
||||
->setValue($url);
|
||||
$this->addElement($feedUrl);
|
||||
}
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
"copyright" => "s",
|
||||
"cuein" => "n",
|
||||
"cueout" => "n",
|
||||
"description" => "s",
|
||||
"artist_name" => "s",
|
||||
"encoded_by" => "s",
|
||||
"utime" => "n",
|
||||
|
@ -55,6 +56,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
"copyright" => _("Copyright"),
|
||||
"cuein" => _("Cue In"),
|
||||
"cueout" => _("Cue Out"),
|
||||
"description" => _("Description"),
|
||||
"artist_name" => _("Creator"),
|
||||
"encoded_by" => _("Encoded By"),
|
||||
"genre" => _("Genre"),
|
||||
|
@ -489,6 +491,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
"copyright" => "DbCopyright",
|
||||
"cuein" => "DbCuein",
|
||||
"cueout" => "DbCueout",
|
||||
"description" => "DbDescription",
|
||||
"encoded_by" => "DbEncodedBy",
|
||||
"utime" => "DbUtime",
|
||||
"mtime" => "DbMtime",
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_StationPodcast extends Zend_Form {
|
||||
|
||||
public function init() {
|
||||
// Station Podcast form
|
||||
$podcastPreferences = new Application_Form_PodcastPreferences();
|
||||
$this->addSubForm($podcastPreferences, 'preferences_podcast');
|
||||
|
||||
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
||||
$csrf_element->setValue($csrf_namespace->authtoken)
|
||||
->setRequired('true')
|
||||
->removeDecorator('HtmlTag')
|
||||
->removeDecorator('Label');
|
||||
$this->addElement($csrf_element);
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,9 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|||
<?php echo $this->partial('partialviews/trialBox.phtml', array("is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||
|
||||
<div id="Panel" class="sticky">
|
||||
<?php if($this->suspended) : ?>
|
||||
<?php if ($this->suspended && $this->isTrial()) : ?>
|
||||
<?php echo $this->partial('partialviews/suspendedtrial.phtml'); ?>
|
||||
<?php elseif ($this->suspended && !$this->isTrial()) : ?>
|
||||
<?php echo $this->partial('partialviews/suspended.phtml'); ?>
|
||||
<?php else : ?>
|
||||
|
||||
|
@ -66,36 +68,42 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|||
<a href="#"><?php echo _("Webstream") ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<a href="/Plupload">
|
||||
<a href="<?php echo Application_Common_OsPath::getBaseDir() . 'plupload' ?>">
|
||||
<button id="add_media_btn" class="btn btn-small dashboard-btn btn-new">
|
||||
<span><?php echo _("Upload") ?></span>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="media_type_selector top-link" data-selection-id="1">
|
||||
<a href="/showbuilder#"><i class='icon-home icon-white'></i><?php echo _("Dashboard") ?></a></div>
|
||||
<div class="media_type_selector dashboard_sub_nav" data-selection-id="1">
|
||||
<a href="/showbuilder#tracks"><i class='icon-music icon-white'></i><?php echo _("Tracks") ?></a></div>
|
||||
<div class="media_type_selector dashboard_sub_nav" data-selection-id="2">
|
||||
<a href="/showbuilder#playlists"><i class='icon-list icon-white'></i><?php echo _("Playlists") ?></a></div>
|
||||
<div class="media_type_selector dashboard_sub_nav" data-selection-id="3">
|
||||
<a href="/showbuilder#smart-blocks"><i class='icon-time icon-white'></i><?php echo _("Smart Blocks") ?></a></div>
|
||||
<div class="media_type_selector dashboard_sub_nav" data-selection-id="4">
|
||||
<a href="/showbuilder#webstreams"><i class='icon-random icon-white'></i><?php echo _("Webstreams") ?></a></div>
|
||||
|
||||
<div class="media_type_selector top-link" data-selection-id="<?php echo MediaType::getDefault(); ?>">
|
||||
<a href="<?php echo Application_Common_OsPath::getBaseDir() . 'showbuilder#' ?>">
|
||||
<i class='icon-home icon-white'></i>
|
||||
<?php echo _("Dashboard") ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php $subnavPrefix = "/showbuilder"; require_once APPLICATION_PATH . "views/scripts/partialviews/dashboard-sub-nav.php"; ?>
|
||||
<div class="media_type_selector dashboard_sub_nav" data-selection-id="<?php echo MediaType::PODCAST ?>">
|
||||
<a href="<?php echo $subnavPrefix; ?>#podcasts">
|
||||
<span class="selector-name"><i class='icon-headphones icon-white'></i><?php echo _("Podcasts") ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<hr style="margin-left: 5px; margin-right: 5px">
|
||||
<div id="nav">
|
||||
<?php echo $this->navigation()->menu(); ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<?php
|
||||
$partitions = Application_Model_Systemstatus::GetDiskInfo();
|
||||
$status = new StdClass;
|
||||
$partitions = $partitions;
|
||||
$disk = $partitions[0];
|
||||
$used = $disk->totalSpace-$disk->totalFreeSpace;
|
||||
$total = $disk->totalSpace;
|
||||
echo "var remainingDiskSpace = ".$disk->totalFreeSpace.";";
|
||||
?>
|
||||
<div id="disk_usage" style="height: 13px; position:fixed; bottom: 5px; left: 10px;">
|
||||
</script>
|
||||
<div id="disk_usage">
|
||||
<!--<div style="padding-bottom: 2px;">Disk Usage</div>-->
|
||||
<div class="disk_usage_progress_bar"></div>
|
||||
<div class="disk_usage_percent_in_use"><?php echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30)); ?></div>
|
||||
|
|
|
@ -66,6 +66,7 @@ class Application_Model_Block implements Application_Model_LibraryEditable
|
|||
"copyright" => "DbCopyright",
|
||||
"cuein" => "DbCuein",
|
||||
"cueout" => "DbCueout",
|
||||
"description" => "DbDescription",
|
||||
"encoded_by" => "DbEncodedBy",
|
||||
"utime" => "DbUtime",
|
||||
"mtime" => "DbMtime",
|
||||
|
@ -187,8 +188,6 @@ class Application_Model_Block implements Application_Model_LibraryEditable
|
|||
*/
|
||||
public function getContents($filterFiles=false)
|
||||
{
|
||||
Logging::info("Getting contents for block {$this->id}");
|
||||
|
||||
$sql = <<<SQL
|
||||
SELECT pc.id AS id,
|
||||
pc.position,
|
||||
|
@ -1357,6 +1356,7 @@ SQL;
|
|||
"copyright" => _("Copyright"),
|
||||
"cuein" => _("Cue In"),
|
||||
"cueout" => _("Cue Out"),
|
||||
"description" => _("Description"),
|
||||
"artist_name" => _("Creator"),
|
||||
"encoded_by" => _("Encoded By"),
|
||||
"genre" => _("Genre"),
|
||||
|
|
|
@ -576,7 +576,9 @@ class Application_Model_Preference
|
|||
} else {
|
||||
// We return the Airtime logo if no logo is set in the database.
|
||||
// airtime_logo.png is stored under the public directory
|
||||
return DEFAULT_LOGO_PLACEHOLDER;
|
||||
$image = @file_get_contents(Application_Common_HTTPHelper::getStationUrl() . DEFAULT_LOGO_FILE);
|
||||
$image = base64_encode($image);
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1506,4 +1508,80 @@ class Application_Model_Preference
|
|||
{
|
||||
self::setValue("whats_new_dialog_viewed", $value, true);
|
||||
}
|
||||
|
||||
public static function getPodcastPollLock() {
|
||||
return self::getValue("podcast_poll_lock");
|
||||
}
|
||||
|
||||
public static function setPodcastPollLock($value)
|
||||
{
|
||||
self::setValue("podcast_poll_lock", $value);
|
||||
}
|
||||
|
||||
public static function getStationPodcastId()
|
||||
{
|
||||
// Create the Station podcast if it doesn't exist.
|
||||
$stationPodcastId = self::getValue("station_podcast_id");
|
||||
if (empty($stationPodcastId)) {
|
||||
$stationPodcastId = Application_Service_PodcastService::createStationPodcast();
|
||||
}
|
||||
return $stationPodcastId;
|
||||
}
|
||||
|
||||
public static function setStationPodcastId($value)
|
||||
{
|
||||
self::setValue("station_podcast_id", $value);
|
||||
}
|
||||
|
||||
// SAAS-1081 - Implement a universal download key for downloading episodes from the station podcast
|
||||
// Store and increment the download counter, resetting every month
|
||||
|
||||
public static function getStationPodcastDownloadKey() {
|
||||
return self::getValue("station_podcast_download_key");
|
||||
}
|
||||
|
||||
public static function setStationPodcastDownloadKey($value = null) {
|
||||
$value = empty($value) ? (new Application_Model_Auth())->generateRandomString() : $value;
|
||||
self::setValue("station_podcast_download_key", $value);
|
||||
}
|
||||
|
||||
public static function getStationPodcastDownloadResetTimer() {
|
||||
return self::getValue("station_podcast_download_reset_timer");
|
||||
}
|
||||
|
||||
public static function setStationPodcastDownloadResetTimer($value) {
|
||||
self::setValue("station_podcast_download_reset_timer", $value);
|
||||
}
|
||||
|
||||
public static function getStationPodcastDownloadCounter() {
|
||||
return self::getValue("station_podcast_download_counter");
|
||||
}
|
||||
|
||||
public static function resetStationPodcastDownloadCounter() {
|
||||
self::setValue("station_podcast_download_counter", 0);
|
||||
}
|
||||
|
||||
public static function incrementStationPodcastDownloadCounter() {
|
||||
$c = self::getStationPodcastDownloadCounter();
|
||||
self::setValue("station_podcast_download_counter", empty($c) ? 1 : ++$c);
|
||||
}
|
||||
|
||||
// For fail cases, we may need to decrement the download counter
|
||||
public static function decrementStationPodcastDownloadCounter() {
|
||||
$c = self::getStationPodcastDownloadCounter();
|
||||
self::setValue("station_podcast_download_counter", empty($c) ? 0 : --$c);
|
||||
}
|
||||
|
||||
public static function getStationPodcastPrivacy() {
|
||||
if (!Billing::isStationPodcastAllowed()) {
|
||||
// return private setting
|
||||
return 1;
|
||||
}
|
||||
|
||||
return self::getValue("station_podcast_privacy");
|
||||
}
|
||||
|
||||
public static function setStationPodcastPrivacy($value) {
|
||||
self::setValue("station_podcast_privacy", $value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ class Application_Model_RabbitMq
|
|||
$channel->exchange_declare($exchange, $exchangeType, false, true, $autoDeleteExchange);
|
||||
|
||||
$msg = new AMQPMessage($jsonData, array('content_type' => 'text/plain'));
|
||||
|
||||
|
||||
$channel->basic_publish($msg, $exchange);
|
||||
$channel->close();
|
||||
$conn->close();
|
||||
|
|
|
@ -133,6 +133,7 @@ class Application_Model_Scheduler
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($showInstances as $instance) {
|
||||
|
||||
$id = $instance->getDbId();
|
||||
|
@ -384,6 +385,24 @@ class Application_Model_Scheduler
|
|||
return $dt;
|
||||
}
|
||||
|
||||
private function findTimeDifference2($p_startDT, $p_endDT) {
|
||||
$startEpoch = $p_startDT->format("U.u");
|
||||
$endEpoch = $p_endDT->format("U.u");
|
||||
|
||||
//add two float numbers to 6 subsecond precision
|
||||
//DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
|
||||
$newEpoch = bcsub($endEpoch, (string)$startEpoch, 6);
|
||||
|
||||
$dt = DateTime::createFromFormat("U.u", $newEpoch, new DateTimeZone("UTC"));
|
||||
|
||||
if ($dt === false) {
|
||||
//PHP 5.3.2 problem
|
||||
$dt = DateTime::createFromFormat("U", intval($newEpoch), new DateTimeZone("UTC"));
|
||||
}
|
||||
|
||||
return $dt;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param DateTime startDT in UTC
|
||||
* @param string duration
|
||||
|
@ -498,12 +517,70 @@ class Application_Model_Scheduler
|
|||
|
||||
$itemStartDT = $instance->getDbStarts(null);
|
||||
foreach ($schedule as $item) {
|
||||
|
||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($itemStartDT)
|
||||
->setDbEnds($itemEndDT);
|
||||
|
||||
$itemStartDT = $itemEndDT;
|
||||
}
|
||||
|
||||
$schedule->save($this->con);
|
||||
}
|
||||
|
||||
/** Temporary hack to copy the track cue in, out, and length from the cc_files table to fix
|
||||
* incorrect track lengths (RKTN-260)
|
||||
*/
|
||||
public function removeGaps2($showInstance, $exclude = null) {
|
||||
|
||||
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
|
||||
if (is_null($instance)) {
|
||||
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
|
||||
}
|
||||
|
||||
$itemStartDT = $instance->getDbStarts(null);
|
||||
|
||||
$schedule = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($showInstance)
|
||||
->filterByDbId($exclude, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
||||
foreach ($schedule as $item) {
|
||||
|
||||
//START OF TIME RECALC HACK
|
||||
|
||||
//TODO: Copy the cue in, cue out, and track length from the cc_files table
|
||||
$file = $item->getCcFiles($this->con);
|
||||
if (!$file) {
|
||||
continue;
|
||||
}
|
||||
$item->setDbCueIn($file->getDbCueIn());
|
||||
$item->setDbCueOut($file->getDbCueOut());
|
||||
|
||||
$cueOut = new DateTime($file->getDbCueOut());
|
||||
$cueIn = new DateTime($file->getDbCueIn());
|
||||
$clipLength = $this->findTimeDifference2($cueIn, $cueOut);
|
||||
|
||||
//The clip length is supposed to be cue out - cue in:
|
||||
//FIXME: How do we correctly do time arithmetic in PHP without losing the millseconds?
|
||||
$item->setDbClipLength($clipLength->format(DEFAULT_INTERVAL_FORMAT));
|
||||
$item->save($this->con);
|
||||
//Ensure we don't get cached results
|
||||
CcSchedulePeer::clearInstancePool();
|
||||
//END OF TIME RECALC HACK
|
||||
|
||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
$item->setDbStarts($itemStartDT)
|
||||
->setDbEnds($itemEndDT)
|
||||
->save($this->con);
|
||||
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
|
||||
}
|
||||
|
||||
$instance->updateDbTimeFilled($this->con); //FIXME: TIME RECALC HACK (Albert)
|
||||
|
||||
$schedule->save($this->con);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,6 +57,7 @@ class Application_Model_StoredFile
|
|||
"owner_id" => "DbOwnerId",
|
||||
"cuein" => "DbCueIn",
|
||||
"cueout" => "DbCueOut",
|
||||
"description" => "DbDescription"
|
||||
);
|
||||
|
||||
function __construct($file, $con) {
|
||||
|
@ -672,7 +673,7 @@ SQL;
|
|||
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label",
|
||||
"copyright", "mime", "language", "filepath", "owner_id",
|
||||
"conductor", "replay_gain", "lptime", "is_playlist", "is_scheduled",
|
||||
"cuein", "cueout" );
|
||||
"cuein", "cueout", "description" );
|
||||
}
|
||||
|
||||
public static function searchLibraryFiles($datatables)
|
||||
|
@ -781,7 +782,7 @@ SQL;
|
|||
$blSelect[] = "NULL::VARCHAR AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
$streamSelect[] = $key;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$plSelect[] = "NULL::text AS ".$key;
|
||||
$blSelect[] = "NULL::text AS ".$key;
|
||||
|
@ -805,21 +806,17 @@ SQL;
|
|||
$unionTable = "({$plTable} UNION {$blTable} UNION {$fileTable} UNION {$streamTable}) AS RESULTS";
|
||||
|
||||
//choose which table we need to select data from.
|
||||
// TODO : use constants instead of numbers -- RG
|
||||
switch ($type) {
|
||||
case 0:
|
||||
$fromTable = $unionTable;
|
||||
break;
|
||||
case 1:
|
||||
case MediaType::FILE:
|
||||
$fromTable = $fileTable." AS File"; //need an alias for the table if it's standalone.
|
||||
break;
|
||||
case 2:
|
||||
case MediaType::PLAYLIST:
|
||||
$fromTable = $plTable." AS Playlist"; //need an alias for the table if it's standalone.
|
||||
break;
|
||||
case 3:
|
||||
case MediaType::BLOCK:
|
||||
$fromTable = $blTable." AS Block"; //need an alias for the table if it's standalone.
|
||||
break;
|
||||
case 4:
|
||||
case MediaType::WEBSTREAM:
|
||||
$fromTable = $streamTable." AS StreamTable"; //need an alias for the table if it's standalone.
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -135,6 +135,13 @@ class CcFiles extends BaseCcFiles {
|
|||
|
||||
try
|
||||
{
|
||||
//Only accept files with a file extension that we support.
|
||||
// Let the analyzer do the heavy lifting in terms of mime verification and playability
|
||||
$fileExtension = pathinfo($originalFilename, PATHINFO_EXTENSION);
|
||||
if (!in_array(strtolower($fileExtension), array_values(FileDataHelper::getAudioMimeTypeArray()))) {
|
||||
throw new Exception("Bad file extension.");
|
||||
}
|
||||
|
||||
$fileArray = self::removeBlacklistedFields($fileArray);
|
||||
|
||||
self::validateFileArray($fileArray);
|
||||
|
@ -147,12 +154,6 @@ class CcFiles extends BaseCcFiles {
|
|||
$file->setDbHidden(true);
|
||||
$file->save();
|
||||
|
||||
//Only accept files with a file extension that we support.
|
||||
$fileExtension = pathinfo($originalFilename, PATHINFO_EXTENSION);
|
||||
if (!in_array(strtolower($fileExtension), array_values(FileDataHelper::getAudioMimeTypeArray()))) {
|
||||
throw new Exception("Bad file extension.");
|
||||
}
|
||||
|
||||
$callbackUrl = Application_Common_HTTPHelper::getStationUrl() . "/rest/media/" . $file->getPrimaryKey();
|
||||
|
||||
Application_Service_MediaService::importFileToLibrary($callbackUrl, $filePath,
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'imported_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class ImportedPodcast extends BaseImportedPodcast
|
||||
{
|
||||
/*public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
|
||||
{
|
||||
$importedPodcastArray = parent::toArray(BasePeer::TYPE_FIELDNAME);
|
||||
//unset this ID so we only pass back the Podcast ID
|
||||
unset($importedPodcastArray["id"]);
|
||||
|
||||
$podcastArray = $this->getPodcast()->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
$array = array_merge($podcastArray, $importedPodcastArray);
|
||||
|
||||
//unset podcast_id because we already have that value in $importedPodcastArray
|
||||
unset($array["podcast_id"]);
|
||||
|
||||
return $array;
|
||||
}*/
|
||||
}
|
|
@ -0,0 +1,251 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'imported_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class ImportedPodcast extends BaseImportedPodcast
|
||||
{
|
||||
// These fields should never be modified with POST/PUT data
|
||||
private static $privateFields = array(
|
||||
"id",
|
||||
"url",
|
||||
"type",
|
||||
"owner"
|
||||
);
|
||||
|
||||
/** Creates a Podcast object from the given podcast URL.
|
||||
* This is used by our Podcast REST API
|
||||
*
|
||||
* @param $data An array containing the URL for a Podcast object.
|
||||
*
|
||||
* @return array - Podcast Array with a full list of episodes
|
||||
* @throws Exception
|
||||
* @throws InvalidPodcastException
|
||||
* @throws PodcastLimitReachedException
|
||||
*/
|
||||
public static function create($data)
|
||||
{
|
||||
if (Application_Service_PodcastService::podcastLimitReached()) {
|
||||
throw new PodcastLimitReachedException();
|
||||
}
|
||||
|
||||
$rss = Application_Service_PodcastService::getPodcastFeed($data["url"]);
|
||||
if (!$rss) {
|
||||
throw new InvalidPodcastException();
|
||||
}
|
||||
|
||||
// Ensure we are only creating Podcast with the given URL, and excluding
|
||||
// any extra data fields that may have been POSTED
|
||||
$podcastArray = array();
|
||||
$podcastArray["url"] = $data["url"];
|
||||
|
||||
$podcastArray["title"] = $rss->get_title();
|
||||
$podcastArray["description"] = $rss->get_description();
|
||||
$podcastArray["link"] = $rss->get_link();
|
||||
$podcastArray["language"] = $rss->get_language();
|
||||
$podcastArray["copyright"] = $rss->get_copyright();
|
||||
$podcastArray["creator"] = $rss->get_author()->get_name();
|
||||
$podcastArray["category"] = $rss->get_categories();
|
||||
|
||||
$itunesChannel = "http://www.itunes.com/dtds/podcast-1.0.dtd";
|
||||
|
||||
$itunesSubtitle = $rss->get_channel_tags($itunesChannel, 'subtitle');
|
||||
$podcastArray["itunes_subtitle"] = isset($itunesSubtitle[0]["data"]) ? $itunesSubtitle[0]["data"] : "";
|
||||
|
||||
$itunesCategory = $rss->get_channel_tags($itunesChannel, 'category');
|
||||
$categoryArray = array();
|
||||
foreach ($itunesCategory as $c => $data) {
|
||||
foreach ($data["attribs"] as $attrib) {
|
||||
array_push($categoryArray, $attrib["text"]);
|
||||
}
|
||||
}
|
||||
$podcastArray["itunes_category"] = implode(",", $categoryArray);
|
||||
|
||||
$itunesAuthor = $rss->get_channel_tags($itunesChannel, 'author');
|
||||
$podcastArray["itunes_author"] = isset($itunesAuthor[0]["data"]) ? $itunesAuthor[0]["data"] : "";
|
||||
|
||||
$itunesSummary = $rss->get_channel_tags($itunesChannel, 'summary');
|
||||
$podcastArray["itunes_summary"] = isset($itunesSummary[0]["data"]) ? $itunesSummary[0]["data"] : "";
|
||||
|
||||
$itunesKeywords = $rss->get_channel_tags($itunesChannel, 'keywords');
|
||||
$podcastArray["itunes_keywords"] = isset($itunesKeywords[0]["data"]) ? $itunesKeywords[0]["data"] : "";
|
||||
|
||||
$itunesExplicit = $rss->get_channel_tags($itunesChannel, 'explicit');
|
||||
$podcastArray["itunes_explicit"] = isset($itunesExplicit[0]["data"]) ? $itunesExplicit[0]["data"] : "";
|
||||
|
||||
self::validatePodcastMetadata($podcastArray);
|
||||
|
||||
try {
|
||||
$podcast = new ImportedPodcast();
|
||||
$podcast->fromArray($podcastArray, BasePeer::TYPE_FIELDNAME);
|
||||
$podcast->setDbOwner(self::getOwnerId());
|
||||
$podcast->setDbType(IMPORTED_PODCAST);
|
||||
$podcast->save();
|
||||
|
||||
return self::_generatePodcastArray($podcast, $rss);
|
||||
} catch(Exception $e) {
|
||||
$podcast->delete();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a Podcast's rss feed and returns all its episodes with
|
||||
* the Podcast object
|
||||
*
|
||||
* @param $podcastId
|
||||
*
|
||||
* @throws PodcastNotFoundException
|
||||
* @throws InvalidPodcastException
|
||||
* @return array - Podcast Array with a full list of episodes
|
||||
*/
|
||||
public static function getPodcastById($podcastId)
|
||||
{
|
||||
$podcast = PodcastQuery::create()->findPk($podcastId);
|
||||
if (!$podcast) {
|
||||
throw new PodcastNotFoundException();
|
||||
}
|
||||
|
||||
$rss = Application_Service_PodcastService::getPodcastFeed($podcast->getDbUrl());
|
||||
if (!$rss) {
|
||||
throw new InvalidPodcastException();
|
||||
}
|
||||
|
||||
return self::_generatePodcastArray($podcast, $rss);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a podcast object and a SimplePie feed object,
|
||||
* generate a data array to pass back to the front-end
|
||||
*
|
||||
* @param Podcast $podcast Podcast model object
|
||||
* @param SimplePie $rss SimplePie feed object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function _generatePodcastArray($podcast, $rss) {
|
||||
$podcastArray = $podcast->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
$podcastArray["episodes"] = array();
|
||||
foreach ($rss->get_items() as $item) {
|
||||
/** @var SimplePie_Item $item */
|
||||
array_push($podcastArray["episodes"], array(
|
||||
"guid" => $item->get_id(),
|
||||
"title" => $item->get_title(),
|
||||
"author" => $item->get_author()->get_name(),
|
||||
"description" => $item->get_description(),
|
||||
"pub_date" => $item->get_date("Y-m-d H:i:s"),
|
||||
"link" => $item->get_link(),
|
||||
"enclosure" => $item->get_enclosure()
|
||||
));
|
||||
}
|
||||
|
||||
return $podcastArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a Podcast object with the given metadata
|
||||
*
|
||||
* @param $podcastId
|
||||
* @param $data
|
||||
* @return array
|
||||
* @throws Exception
|
||||
* @throws PodcastNotFoundException
|
||||
*/
|
||||
public static function updateFromArray($podcastId, $data)
|
||||
{
|
||||
$podcast = PodcastQuery::create()->findPk($podcastId);
|
||||
if (!$podcast) {
|
||||
throw new PodcastNotFoundException();
|
||||
}
|
||||
|
||||
self::removePrivateFields($data);
|
||||
self::validatePodcastMetadata($data);
|
||||
|
||||
$podcast->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$podcast->save();
|
||||
|
||||
return $podcast->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a Podcast and its podcast episodes
|
||||
*
|
||||
* @param $podcastId
|
||||
* @throws Exception
|
||||
* @throws PodcastNotFoundException
|
||||
*/
|
||||
public static function deleteById($podcastId)
|
||||
{
|
||||
$podcast = PodcastQuery::create()->findPk($podcastId);
|
||||
if ($podcast) {
|
||||
$podcast->delete();
|
||||
} else {
|
||||
throw new PodcastNotFoundException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims the podcast metadata to fit the table's column max size
|
||||
*
|
||||
* @param $podcastArray
|
||||
*/
|
||||
private static function validatePodcastMetadata(&$podcastArray)
|
||||
{
|
||||
$podcastTable = PodcastPeer::getTableMap();
|
||||
|
||||
foreach ($podcastArray as $key => &$value) {
|
||||
try {
|
||||
// Make sure column exists in table
|
||||
$columnMaxSize = $podcastTable->getColumn($key)->getSize();
|
||||
} catch (PropelException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strlen($value) > $columnMaxSize) {
|
||||
$value = substr($value, 0, $podcastTable->getColumn($key)->getSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function removePrivateFields(&$data)
|
||||
{
|
||||
foreach (self::$privateFields as $key) {
|
||||
unset($data[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO move this somewhere where it makes sense
|
||||
private static function getOwnerId()
|
||||
{
|
||||
try {
|
||||
if (Zend_Auth::getInstance()->hasIdentity()) {
|
||||
$service_user = new Application_Service_UserService();
|
||||
return $service_user->getCurrentUser()->getDbId();
|
||||
} else {
|
||||
$defaultOwner = CcSubjsQuery::create()
|
||||
->filterByDbType('A')
|
||||
->orderByDbId()
|
||||
->findOne();
|
||||
if (!$defaultOwner) {
|
||||
// what to do if there is no admin user?
|
||||
// should we handle this case?
|
||||
return null;
|
||||
}
|
||||
return $defaultOwner->getDbId();
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'imported_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class ImportedPodcastPeer extends BaseImportedPodcastPeer
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'imported_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class ImportedPodcastQuery extends BaseImportedPodcastQuery
|
||||
{
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class Podcast extends BasePodcast
|
||||
{
|
||||
/**
|
||||
* Override this function so it returns its child class fields as well.
|
||||
* Child class will either be ImportedPodcast or StationPodcast
|
||||
*
|
||||
* @param string $keyType
|
||||
* @param bool $includeLazyLoadColumns
|
||||
* @param array $alreadyDumpedObjects
|
||||
* @param bool $includeForeignObjects
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
|
||||
{
|
||||
$podcastArray = parent::toArray($keyType);
|
||||
|
||||
$importedPodcast = ImportedPodcastQuery::create()->filterByDbPodcastId($this->getDbId())->findOne();
|
||||
$stationPodcast = StationPodcastQuery::create()->filterByDbPodcastId($this->getDbId())->findOne();
|
||||
if (!is_null($importedPodcast)) {
|
||||
$importedPodcastArray = $importedPodcast->toArray($keyType);
|
||||
|
||||
//unset these values because we already have the podcast id in $podcastArray
|
||||
//and we don't need the imported podcast ID
|
||||
unset($importedPodcastArray["id"]);
|
||||
unset($importedPodcastArray["podcast_id"]);
|
||||
|
||||
return array_merge($podcastArray, $importedPodcastArray);
|
||||
|
||||
} else if (!is_null($stationPodcast)) {
|
||||
// For now just return $podcastArray because StationPodcast objects do not have any
|
||||
// extra fields we want to return. This may change in the future.
|
||||
return $podcastArray;
|
||||
} else {
|
||||
return $podcastArray;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this function so it updates the child class as well.
|
||||
* Child class will either be ImportedPodcast or StationPodcast
|
||||
*
|
||||
* @param array $arr
|
||||
* @param string $keyType
|
||||
* @throws Exception
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
parent::fromArray($arr, $keyType);
|
||||
|
||||
$importedPodcast = ImportedPodcastQuery::create()->filterByDbPodcastId($this->getDbId())->findOne();
|
||||
if (!is_null($importedPodcast)) {
|
||||
$importedPodcast->fromArray($arr, $keyType);
|
||||
$importedPodcast->save();
|
||||
} else {
|
||||
//TODO: station podcast
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'podcast_episodes' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class PodcastEpisodes extends BasePodcastEpisodes
|
||||
{
|
||||
|
||||
/**
|
||||
* @override
|
||||
* We need to override this function in order to provide the rotating
|
||||
* download key for the station podcast.
|
||||
*
|
||||
* Get the [download_url] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDbDownloadUrl() {
|
||||
$podcastId = $this->getDbPodcastId();
|
||||
// We may have more station podcasts later, so use this instead of checking the id stored in Preference
|
||||
$podcast = StationPodcastQuery::create()->findOneByDbPodcastId($podcastId);
|
||||
if ($podcast) {
|
||||
$fileId = $this->getDbFileId();
|
||||
// FIXME: this is an interim solution until we can do better...
|
||||
$file = CcFilesQuery::create()->findPk($fileId);
|
||||
$ext = FileDataHelper::getAudioMimeTypeArray()[$file->getDbMime()];
|
||||
$key = Application_Model_Preference::getStationPodcastDownloadKey();
|
||||
return Application_Common_HTTPHelper::getStationUrl()."rest/media/$fileId/download/$key.$ext";
|
||||
}
|
||||
return parent::getDbDownloadUrl();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'podcast_episodes' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class PodcastEpisodesPeer extends BasePodcastEpisodesPeer
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'podcast_episodes' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class PodcastEpisodesQuery extends BasePodcastEpisodesQuery
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class PodcastPeer extends BasePodcastPeer
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class PodcastQuery extends BasePodcastQuery
|
||||
{
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'station_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class StationPodcast extends BaseStationPodcast
|
||||
{
|
||||
|
||||
/**
|
||||
* Utility function to check whether an episode for the file with the given ID
|
||||
* is contained within the station podcast
|
||||
*
|
||||
* @param int $fileId the file ID to check for
|
||||
*
|
||||
* @return bool true if the station podcast contains an episode with
|
||||
* the given file ID, otherwise false
|
||||
*/
|
||||
public function hasEpisodeForFile($fileId) {
|
||||
$episodes = PodcastEpisodesQuery::create()
|
||||
->filterByDbPodcastId($this->getDbPodcastId())
|
||||
->find();
|
||||
foreach ($episodes as $e) {
|
||||
if ($e->getDbFileId() == $fileId) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'station_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class StationPodcastPeer extends BaseStationPodcastPeer
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'station_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class StationPodcastQuery extends BaseStationPodcastQuery
|
||||
{
|
||||
}
|
|
@ -110,6 +110,7 @@ class CcFilesTableMap extends TableMap
|
|||
$this->addColumn('is_scheduled', 'DbIsScheduled', 'BOOLEAN', false, null, false);
|
||||
$this->addColumn('is_playlist', 'DbIsPlaylist', 'BOOLEAN', false, null, false);
|
||||
$this->addColumn('filesize', 'DbFilesize', 'INTEGER', true, null, 0);
|
||||
$this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
@ -128,6 +129,7 @@ class CcFilesTableMap extends TableMap
|
|||
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcSchedules');
|
||||
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlayoutHistorys');
|
||||
$this->addRelation('ThirdPartyTrackReferences', 'ThirdPartyTrackReferences', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'ThirdPartyTrackReferencess');
|
||||
$this->addRelation('PodcastEpisodes', 'PodcastEpisodes', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'PodcastEpisodess');
|
||||
} // buildRelations()
|
||||
|
||||
} // CcFilesTableMap
|
||||
|
|
|
@ -69,6 +69,7 @@ class CcSubjsTableMap extends TableMap
|
|||
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null, 'CcPrefs');
|
||||
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null, 'CcSesss');
|
||||
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null, 'CcSubjsTokens');
|
||||
$this->addRelation('Podcast', 'Podcast', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), 'CASCADE', null, 'Podcasts');
|
||||
} // buildRelations()
|
||||
|
||||
} // CcSubjsTableMap
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'imported_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class ImportedPodcastTableMap extends TableMap
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.ImportedPodcastTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('imported_podcast');
|
||||
$this->setPhpName('ImportedPodcast');
|
||||
$this->setClassname('ImportedPodcast');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('imported_podcast_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false);
|
||||
$this->addColumn('auto_ingest_timestamp', 'DbAutoIngestTimestamp', 'TIMESTAMP', false, null, null);
|
||||
$this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('podcast_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'delegate' => array (
|
||||
'to' => 'podcast',
|
||||
),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
} // ImportedPodcastTableMap
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'podcast_contents' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class PodcastContentsTableMap extends TableMap
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.PodcastContentsTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('podcast_contents');
|
||||
$this->setPhpName('PodcastContents');
|
||||
$this->setClassname('PodcastContents');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('podcast_contents_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', true, null, null);
|
||||
$this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null);
|
||||
$this->addColumn('publication_date', 'DbPublicationDate', 'TIMESTAMP', true, null, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('podcast_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // PodcastContentsTableMap
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'podcast_episodes' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class PodcastEpisodesTableMap extends TableMap
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.PodcastEpisodesTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('podcast_episodes');
|
||||
$this->setPhpName('PodcastEpisodes');
|
||||
$this->setClassname('PodcastEpisodes');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('podcast_episodes_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
|
||||
$this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null);
|
||||
$this->addColumn('publication_date', 'DbPublicationDate', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('download_url', 'DbDownloadUrl', 'VARCHAR', true, 4096, null);
|
||||
$this->addColumn('episode_guid', 'DbEpisodeGuid', 'VARCHAR', true, 4096, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('podcast_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // PodcastEpisodesTableMap
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class PodcastTableMap extends TableMap
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.PodcastTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('podcast');
|
||||
$this->setPhpName('Podcast');
|
||||
$this->setClassname('Podcast');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('podcast_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('url', 'DbUrl', 'VARCHAR', true, 4096, null);
|
||||
$this->addColumn('title', 'DbTitle', 'VARCHAR', true, 4096, null);
|
||||
$this->addColumn('creator', 'DbCreator', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('description', 'DbDescription', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('language', 'DbLanguage', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('copyright', 'DbCopyright', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('link', 'DbLink', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('itunes_author', 'DbItunesAuthor', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('itunes_keywords', 'DbItunesKeywords', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('itunes_summary', 'DbItunesSummary', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('itunes_subtitle', 'DbItunesSubtitle', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('itunes_category', 'DbItunesCategory', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('itunes_explicit', 'DbItunesExplicit', 'VARCHAR', false, 4096, null);
|
||||
$this->addForeignKey('owner', 'DbOwner', 'INTEGER', 'cc_subjs', 'id', false, null, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('StationPodcast', 'StationPodcast', RelationMap::ONE_TO_MANY, array('id' => 'podcast_id', ), 'CASCADE', null, 'StationPodcasts');
|
||||
$this->addRelation('ImportedPodcast', 'ImportedPodcast', RelationMap::ONE_TO_MANY, array('id' => 'podcast_id', ), 'CASCADE', null, 'ImportedPodcasts');
|
||||
$this->addRelation('PodcastEpisodes', 'PodcastEpisodes', RelationMap::ONE_TO_MANY, array('id' => 'podcast_id', ), 'CASCADE', null, 'PodcastEpisodess');
|
||||
} // buildRelations()
|
||||
|
||||
} // PodcastTableMap
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'station_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class StationPodcastTableMap extends TableMap
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.StationPodcastTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('station_podcast');
|
||||
$this->setPhpName('StationPodcast');
|
||||
$this->setClassname('StationPodcast');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('station_podcast_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('podcast_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'delegate' => array (
|
||||
'to' => 'podcast',
|
||||
),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
} // StationPodcastTableMap
|
|
@ -470,6 +470,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $filesize;
|
||||
|
||||
/**
|
||||
* The value for the description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var CcSubjs
|
||||
*/
|
||||
|
@ -527,6 +533,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
protected $collThirdPartyTrackReferencess;
|
||||
protected $collThirdPartyTrackReferencessPartial;
|
||||
|
||||
/**
|
||||
* @var PropelObjectCollection|PodcastEpisodes[] Collection to store aggregation of PodcastEpisodes objects.
|
||||
*/
|
||||
protected $collPodcastEpisodess;
|
||||
protected $collPodcastEpisodessPartial;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
|
@ -589,6 +601,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $thirdPartyTrackReferencessScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $podcastEpisodessScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Applies default values to this object.
|
||||
* This method should be called from the object's constructor (or
|
||||
|
@ -1501,6 +1519,17 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return $this->filesize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDbDescription()
|
||||
{
|
||||
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
|
@ -3052,6 +3081,27 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbFilesize()
|
||||
|
||||
/**
|
||||
* Set the value of [description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return CcFiles The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbDescription($v)
|
||||
{
|
||||
if ($v !== null && is_numeric($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->description !== $v) {
|
||||
$this->description = $v;
|
||||
$this->modifiedColumns[] = CcFilesPeer::DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setDbDescription()
|
||||
|
||||
/**
|
||||
* Indicates whether the columns in this object are only set to default values.
|
||||
*
|
||||
|
@ -3215,6 +3265,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->is_scheduled = ($row[$startcol + 68] !== null) ? (boolean) $row[$startcol + 68] : null;
|
||||
$this->is_playlist = ($row[$startcol + 69] !== null) ? (boolean) $row[$startcol + 69] : null;
|
||||
$this->filesize = ($row[$startcol + 70] !== null) ? (int) $row[$startcol + 70] : null;
|
||||
$this->description = ($row[$startcol + 71] !== null) ? (string) $row[$startcol + 71] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -3224,7 +3275,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
$this->postHydrate($row, $startcol, $rehydrate);
|
||||
|
||||
return $startcol + 71; // 71 = CcFilesPeer::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 72; // 72 = CcFilesPeer::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcFiles object", $e);
|
||||
|
@ -3312,6 +3363,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
|
||||
$this->collThirdPartyTrackReferencess = null;
|
||||
|
||||
$this->collPodcastEpisodess = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
|
@ -3581,6 +3634,23 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
@ -3830,6 +3900,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if ($this->isColumnModified(CcFilesPeer::FILESIZE)) {
|
||||
$modifiedColumns[':p' . $index++] = '"filesize"';
|
||||
}
|
||||
if ($this->isColumnModified(CcFilesPeer::DESCRIPTION)) {
|
||||
$modifiedColumns[':p' . $index++] = '"description"';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'INSERT INTO "cc_files" (%s) VALUES (%s)',
|
||||
|
@ -4054,6 +4127,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
case '"filesize"':
|
||||
$stmt->bindValue($identifier, $this->filesize, PDO::PARAM_INT);
|
||||
break;
|
||||
case '"description"':
|
||||
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
|
@ -4226,6 +4302,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->collPodcastEpisodess !== null) {
|
||||
foreach ($this->collPodcastEpisodess as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
|
@ -4474,6 +4558,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
case 70:
|
||||
return $this->getDbFilesize();
|
||||
break;
|
||||
case 71:
|
||||
return $this->getDbDescription();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
|
@ -4574,6 +4661,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$keys[68] => $this->getDbIsScheduled(),
|
||||
$keys[69] => $this->getDbIsPlaylist(),
|
||||
$keys[70] => $this->getDbFilesize(),
|
||||
$keys[71] => $this->getDbDescription(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
|
@ -4611,6 +4699,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if (null !== $this->collThirdPartyTrackReferencess) {
|
||||
$result['ThirdPartyTrackReferencess'] = $this->collThirdPartyTrackReferencess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collPodcastEpisodess) {
|
||||
$result['PodcastEpisodess'] = $this->collPodcastEpisodess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -4858,6 +4949,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
case 70:
|
||||
$this->setDbFilesize($value);
|
||||
break;
|
||||
case 71:
|
||||
$this->setDbDescription($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
|
@ -4953,6 +5047,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if (array_key_exists($keys[68], $arr)) $this->setDbIsScheduled($arr[$keys[68]]);
|
||||
if (array_key_exists($keys[69], $arr)) $this->setDbIsPlaylist($arr[$keys[69]]);
|
||||
if (array_key_exists($keys[70], $arr)) $this->setDbFilesize($arr[$keys[70]]);
|
||||
if (array_key_exists($keys[71], $arr)) $this->setDbDescription($arr[$keys[71]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5035,6 +5130,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if ($this->isColumnModified(CcFilesPeer::IS_SCHEDULED)) $criteria->add(CcFilesPeer::IS_SCHEDULED, $this->is_scheduled);
|
||||
if ($this->isColumnModified(CcFilesPeer::IS_PLAYLIST)) $criteria->add(CcFilesPeer::IS_PLAYLIST, $this->is_playlist);
|
||||
if ($this->isColumnModified(CcFilesPeer::FILESIZE)) $criteria->add(CcFilesPeer::FILESIZE, $this->filesize);
|
||||
if ($this->isColumnModified(CcFilesPeer::DESCRIPTION)) $criteria->add(CcFilesPeer::DESCRIPTION, $this->description);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
@ -5168,6 +5264,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$copyObj->setDbIsScheduled($this->getDbIsScheduled());
|
||||
$copyObj->setDbIsPlaylist($this->getDbIsPlaylist());
|
||||
$copyObj->setDbFilesize($this->getDbFilesize());
|
||||
$copyObj->setDbDescription($this->getDbDescription());
|
||||
|
||||
if ($deepCopy && !$this->startCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
|
@ -5218,6 +5315,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($this->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)
|
||||
|
@ -5456,6 +5559,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if ('ThirdPartyTrackReferences' == $relationName) {
|
||||
$this->initThirdPartyTrackReferencess();
|
||||
}
|
||||
if ('PodcastEpisodes' == $relationName) {
|
||||
$this->initPodcastEpisodess();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7233,6 +7339,256 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
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 CcFiles 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 CcFiles is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return PropelObjectCollection|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)
|
||||
->filterByCcFiles($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 CcFiles 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->setCcFiles(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
|
||||
->filterByCcFiles($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 CcFiles 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->setCcFiles($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PodcastEpisodes $podcastEpisodes The podcastEpisodes object to remove.
|
||||
* @return CcFiles 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[]= $podcastEpisodes;
|
||||
$podcastEpisodes->setCcFiles(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this CcFiles is new, it will return
|
||||
* an empty collection; or if this CcFiles has previously
|
||||
* been saved, it will retrieve related 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 CcFiles.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return PropelObjectCollection|PodcastEpisodes[] List of PodcastEpisodes objects
|
||||
*/
|
||||
public function getPodcastEpisodessJoinPodcast($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = PodcastEpisodesQuery::create(null, $criteria);
|
||||
$query->joinWith('Podcast', $join_behavior);
|
||||
|
||||
return $this->getPodcastEpisodess($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
|
@ -7309,6 +7665,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->is_scheduled = null;
|
||||
$this->is_playlist = null;
|
||||
$this->filesize = null;
|
||||
$this->description = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->alreadyInValidation = false;
|
||||
$this->alreadyInClearAllReferencesDeep = false;
|
||||
|
@ -7367,6 +7724,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collPodcastEpisodess) {
|
||||
foreach ($this->collPodcastEpisodess as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->aFkOwner instanceof Persistent) {
|
||||
$this->aFkOwner->clearAllReferences($deep);
|
||||
}
|
||||
|
@ -7408,6 +7770,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->collThirdPartyTrackReferencess->clearIterator();
|
||||
}
|
||||
$this->collThirdPartyTrackReferencess = null;
|
||||
if ($this->collPodcastEpisodess instanceof PropelCollection) {
|
||||
$this->collPodcastEpisodess->clearIterator();
|
||||
}
|
||||
$this->collPodcastEpisodess = null;
|
||||
$this->aFkOwner = null;
|
||||
$this->aCcSubjsRelatedByDbEditedby = null;
|
||||
$this->aCcMusicDirs = null;
|
||||
|
|
|
@ -24,13 +24,13 @@ abstract class BaseCcFilesPeer
|
|||
const TM_CLASS = 'CcFilesTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 71;
|
||||
const NUM_COLUMNS = 72;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
||||
const NUM_HYDRATE_COLUMNS = 71;
|
||||
const NUM_HYDRATE_COLUMNS = 72;
|
||||
|
||||
/** the column name for the id field */
|
||||
const ID = 'cc_files.id';
|
||||
|
@ -245,6 +245,9 @@ abstract class BaseCcFilesPeer
|
|||
/** the column name for the filesize field */
|
||||
const FILESIZE = 'cc_files.filesize';
|
||||
|
||||
/** the column name for the description field */
|
||||
const DESCRIPTION = 'cc_files.description';
|
||||
|
||||
/** The default string format for model objects of the related table **/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
|
@ -264,12 +267,12 @@ abstract class BaseCcFilesPeer
|
|||
* e.g. CcFilesPeer::$fieldNames[CcFilesPeer::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbFileExists', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbFilesize', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbFileExists', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbFilesize', ),
|
||||
BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID, CcFilesPeer::NAME, CcFilesPeer::MIME, CcFilesPeer::FTYPE, CcFilesPeer::DIRECTORY, CcFilesPeer::FILEPATH, CcFilesPeer::IMPORT_STATUS, CcFilesPeer::CURRENTLYACCESSING, CcFilesPeer::EDITEDBY, CcFilesPeer::MTIME, CcFilesPeer::UTIME, CcFilesPeer::LPTIME, CcFilesPeer::MD5, CcFilesPeer::TRACK_TITLE, CcFilesPeer::ARTIST_NAME, CcFilesPeer::BIT_RATE, CcFilesPeer::SAMPLE_RATE, CcFilesPeer::FORMAT, CcFilesPeer::LENGTH, CcFilesPeer::ALBUM_TITLE, CcFilesPeer::GENRE, CcFilesPeer::COMMENTS, CcFilesPeer::YEAR, CcFilesPeer::TRACK_NUMBER, CcFilesPeer::CHANNELS, CcFilesPeer::URL, CcFilesPeer::BPM, CcFilesPeer::RATING, CcFilesPeer::ENCODED_BY, CcFilesPeer::DISC_NUMBER, CcFilesPeer::MOOD, CcFilesPeer::LABEL, CcFilesPeer::COMPOSER, CcFilesPeer::ENCODER, CcFilesPeer::CHECKSUM, CcFilesPeer::LYRICS, CcFilesPeer::ORCHESTRA, CcFilesPeer::CONDUCTOR, CcFilesPeer::LYRICIST, CcFilesPeer::ORIGINAL_LYRICIST, CcFilesPeer::RADIO_STATION_NAME, CcFilesPeer::INFO_URL, CcFilesPeer::ARTIST_URL, CcFilesPeer::AUDIO_SOURCE_URL, CcFilesPeer::RADIO_STATION_URL, CcFilesPeer::BUY_THIS_URL, CcFilesPeer::ISRC_NUMBER, CcFilesPeer::CATALOG_NUMBER, CcFilesPeer::ORIGINAL_ARTIST, CcFilesPeer::COPYRIGHT, CcFilesPeer::REPORT_DATETIME, CcFilesPeer::REPORT_LOCATION, CcFilesPeer::REPORT_ORGANIZATION, CcFilesPeer::SUBJECT, CcFilesPeer::CONTRIBUTOR, CcFilesPeer::LANGUAGE, CcFilesPeer::FILE_EXISTS, CcFilesPeer::SOUNDCLOUD_ID, CcFilesPeer::SOUNDCLOUD_ERROR_CODE, CcFilesPeer::SOUNDCLOUD_ERROR_MSG, CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, CcFilesPeer::REPLAY_GAIN, CcFilesPeer::OWNER_ID, CcFilesPeer::CUEIN, CcFilesPeer::CUEOUT, CcFilesPeer::SILAN_CHECK, CcFilesPeer::HIDDEN, CcFilesPeer::IS_SCHEDULED, CcFilesPeer::IS_PLAYLIST, CcFilesPeer::FILESIZE, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'FILE_EXISTS', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'FILESIZE', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'file_exists', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'filesize', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbFileExists', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbFilesize', 'DbDescription', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbFileExists', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbFilesize', 'dbDescription', ),
|
||||
BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID, CcFilesPeer::NAME, CcFilesPeer::MIME, CcFilesPeer::FTYPE, CcFilesPeer::DIRECTORY, CcFilesPeer::FILEPATH, CcFilesPeer::IMPORT_STATUS, CcFilesPeer::CURRENTLYACCESSING, CcFilesPeer::EDITEDBY, CcFilesPeer::MTIME, CcFilesPeer::UTIME, CcFilesPeer::LPTIME, CcFilesPeer::MD5, CcFilesPeer::TRACK_TITLE, CcFilesPeer::ARTIST_NAME, CcFilesPeer::BIT_RATE, CcFilesPeer::SAMPLE_RATE, CcFilesPeer::FORMAT, CcFilesPeer::LENGTH, CcFilesPeer::ALBUM_TITLE, CcFilesPeer::GENRE, CcFilesPeer::COMMENTS, CcFilesPeer::YEAR, CcFilesPeer::TRACK_NUMBER, CcFilesPeer::CHANNELS, CcFilesPeer::URL, CcFilesPeer::BPM, CcFilesPeer::RATING, CcFilesPeer::ENCODED_BY, CcFilesPeer::DISC_NUMBER, CcFilesPeer::MOOD, CcFilesPeer::LABEL, CcFilesPeer::COMPOSER, CcFilesPeer::ENCODER, CcFilesPeer::CHECKSUM, CcFilesPeer::LYRICS, CcFilesPeer::ORCHESTRA, CcFilesPeer::CONDUCTOR, CcFilesPeer::LYRICIST, CcFilesPeer::ORIGINAL_LYRICIST, CcFilesPeer::RADIO_STATION_NAME, CcFilesPeer::INFO_URL, CcFilesPeer::ARTIST_URL, CcFilesPeer::AUDIO_SOURCE_URL, CcFilesPeer::RADIO_STATION_URL, CcFilesPeer::BUY_THIS_URL, CcFilesPeer::ISRC_NUMBER, CcFilesPeer::CATALOG_NUMBER, CcFilesPeer::ORIGINAL_ARTIST, CcFilesPeer::COPYRIGHT, CcFilesPeer::REPORT_DATETIME, CcFilesPeer::REPORT_LOCATION, CcFilesPeer::REPORT_ORGANIZATION, CcFilesPeer::SUBJECT, CcFilesPeer::CONTRIBUTOR, CcFilesPeer::LANGUAGE, CcFilesPeer::FILE_EXISTS, CcFilesPeer::SOUNDCLOUD_ID, CcFilesPeer::SOUNDCLOUD_ERROR_CODE, CcFilesPeer::SOUNDCLOUD_ERROR_MSG, CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, CcFilesPeer::REPLAY_GAIN, CcFilesPeer::OWNER_ID, CcFilesPeer::CUEIN, CcFilesPeer::CUEOUT, CcFilesPeer::SILAN_CHECK, CcFilesPeer::HIDDEN, CcFilesPeer::IS_SCHEDULED, CcFilesPeer::IS_PLAYLIST, CcFilesPeer::FILESIZE, CcFilesPeer::DESCRIPTION, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'FILE_EXISTS', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'FILESIZE', 'DESCRIPTION', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'file_exists', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'filesize', 'description', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -279,12 +282,12 @@ abstract class BaseCcFilesPeer
|
|||
* e.g. CcFilesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbImportStatus' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'DbOwnerId' => 63, 'DbCuein' => 64, 'DbCueout' => 65, 'DbSilanCheck' => 66, 'DbHidden' => 67, 'DbIsScheduled' => 68, 'DbIsPlaylist' => 69, 'DbFilesize' => 70, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbImportStatus' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'dbOwnerId' => 63, 'dbCuein' => 64, 'dbCueout' => 65, 'dbSilanCheck' => 66, 'dbHidden' => 67, 'dbIsScheduled' => 68, 'dbIsPlaylist' => 69, 'dbFilesize' => 70, ),
|
||||
BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID => 0, CcFilesPeer::NAME => 1, CcFilesPeer::MIME => 2, CcFilesPeer::FTYPE => 3, CcFilesPeer::DIRECTORY => 4, CcFilesPeer::FILEPATH => 5, CcFilesPeer::IMPORT_STATUS => 6, CcFilesPeer::CURRENTLYACCESSING => 7, CcFilesPeer::EDITEDBY => 8, CcFilesPeer::MTIME => 9, CcFilesPeer::UTIME => 10, CcFilesPeer::LPTIME => 11, CcFilesPeer::MD5 => 12, CcFilesPeer::TRACK_TITLE => 13, CcFilesPeer::ARTIST_NAME => 14, CcFilesPeer::BIT_RATE => 15, CcFilesPeer::SAMPLE_RATE => 16, CcFilesPeer::FORMAT => 17, CcFilesPeer::LENGTH => 18, CcFilesPeer::ALBUM_TITLE => 19, CcFilesPeer::GENRE => 20, CcFilesPeer::COMMENTS => 21, CcFilesPeer::YEAR => 22, CcFilesPeer::TRACK_NUMBER => 23, CcFilesPeer::CHANNELS => 24, CcFilesPeer::URL => 25, CcFilesPeer::BPM => 26, CcFilesPeer::RATING => 27, CcFilesPeer::ENCODED_BY => 28, CcFilesPeer::DISC_NUMBER => 29, CcFilesPeer::MOOD => 30, CcFilesPeer::LABEL => 31, CcFilesPeer::COMPOSER => 32, CcFilesPeer::ENCODER => 33, CcFilesPeer::CHECKSUM => 34, CcFilesPeer::LYRICS => 35, CcFilesPeer::ORCHESTRA => 36, CcFilesPeer::CONDUCTOR => 37, CcFilesPeer::LYRICIST => 38, CcFilesPeer::ORIGINAL_LYRICIST => 39, CcFilesPeer::RADIO_STATION_NAME => 40, CcFilesPeer::INFO_URL => 41, CcFilesPeer::ARTIST_URL => 42, CcFilesPeer::AUDIO_SOURCE_URL => 43, CcFilesPeer::RADIO_STATION_URL => 44, CcFilesPeer::BUY_THIS_URL => 45, CcFilesPeer::ISRC_NUMBER => 46, CcFilesPeer::CATALOG_NUMBER => 47, CcFilesPeer::ORIGINAL_ARTIST => 48, CcFilesPeer::COPYRIGHT => 49, CcFilesPeer::REPORT_DATETIME => 50, CcFilesPeer::REPORT_LOCATION => 51, CcFilesPeer::REPORT_ORGANIZATION => 52, CcFilesPeer::SUBJECT => 53, CcFilesPeer::CONTRIBUTOR => 54, CcFilesPeer::LANGUAGE => 55, CcFilesPeer::FILE_EXISTS => 56, CcFilesPeer::SOUNDCLOUD_ID => 57, CcFilesPeer::SOUNDCLOUD_ERROR_CODE => 58, CcFilesPeer::SOUNDCLOUD_ERROR_MSG => 59, CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE => 60, CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME => 61, CcFilesPeer::REPLAY_GAIN => 62, CcFilesPeer::OWNER_ID => 63, CcFilesPeer::CUEIN => 64, CcFilesPeer::CUEOUT => 65, CcFilesPeer::SILAN_CHECK => 66, CcFilesPeer::HIDDEN => 67, CcFilesPeer::IS_SCHEDULED => 68, CcFilesPeer::IS_PLAYLIST => 69, CcFilesPeer::FILESIZE => 70, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'IMPORT_STATUS' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, 'CUEIN' => 64, 'CUEOUT' => 65, 'SILAN_CHECK' => 66, 'HIDDEN' => 67, 'IS_SCHEDULED' => 68, 'IS_PLAYLIST' => 69, 'FILESIZE' => 70, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'import_status' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, 'cuein' => 64, 'cueout' => 65, 'silan_check' => 66, 'hidden' => 67, 'is_scheduled' => 68, 'is_playlist' => 69, 'filesize' => 70, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbImportStatus' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'DbOwnerId' => 63, 'DbCuein' => 64, 'DbCueout' => 65, 'DbSilanCheck' => 66, 'DbHidden' => 67, 'DbIsScheduled' => 68, 'DbIsPlaylist' => 69, 'DbFilesize' => 70, 'DbDescription' => 71, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbImportStatus' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'dbOwnerId' => 63, 'dbCuein' => 64, 'dbCueout' => 65, 'dbSilanCheck' => 66, 'dbHidden' => 67, 'dbIsScheduled' => 68, 'dbIsPlaylist' => 69, 'dbFilesize' => 70, 'dbDescription' => 71, ),
|
||||
BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID => 0, CcFilesPeer::NAME => 1, CcFilesPeer::MIME => 2, CcFilesPeer::FTYPE => 3, CcFilesPeer::DIRECTORY => 4, CcFilesPeer::FILEPATH => 5, CcFilesPeer::IMPORT_STATUS => 6, CcFilesPeer::CURRENTLYACCESSING => 7, CcFilesPeer::EDITEDBY => 8, CcFilesPeer::MTIME => 9, CcFilesPeer::UTIME => 10, CcFilesPeer::LPTIME => 11, CcFilesPeer::MD5 => 12, CcFilesPeer::TRACK_TITLE => 13, CcFilesPeer::ARTIST_NAME => 14, CcFilesPeer::BIT_RATE => 15, CcFilesPeer::SAMPLE_RATE => 16, CcFilesPeer::FORMAT => 17, CcFilesPeer::LENGTH => 18, CcFilesPeer::ALBUM_TITLE => 19, CcFilesPeer::GENRE => 20, CcFilesPeer::COMMENTS => 21, CcFilesPeer::YEAR => 22, CcFilesPeer::TRACK_NUMBER => 23, CcFilesPeer::CHANNELS => 24, CcFilesPeer::URL => 25, CcFilesPeer::BPM => 26, CcFilesPeer::RATING => 27, CcFilesPeer::ENCODED_BY => 28, CcFilesPeer::DISC_NUMBER => 29, CcFilesPeer::MOOD => 30, CcFilesPeer::LABEL => 31, CcFilesPeer::COMPOSER => 32, CcFilesPeer::ENCODER => 33, CcFilesPeer::CHECKSUM => 34, CcFilesPeer::LYRICS => 35, CcFilesPeer::ORCHESTRA => 36, CcFilesPeer::CONDUCTOR => 37, CcFilesPeer::LYRICIST => 38, CcFilesPeer::ORIGINAL_LYRICIST => 39, CcFilesPeer::RADIO_STATION_NAME => 40, CcFilesPeer::INFO_URL => 41, CcFilesPeer::ARTIST_URL => 42, CcFilesPeer::AUDIO_SOURCE_URL => 43, CcFilesPeer::RADIO_STATION_URL => 44, CcFilesPeer::BUY_THIS_URL => 45, CcFilesPeer::ISRC_NUMBER => 46, CcFilesPeer::CATALOG_NUMBER => 47, CcFilesPeer::ORIGINAL_ARTIST => 48, CcFilesPeer::COPYRIGHT => 49, CcFilesPeer::REPORT_DATETIME => 50, CcFilesPeer::REPORT_LOCATION => 51, CcFilesPeer::REPORT_ORGANIZATION => 52, CcFilesPeer::SUBJECT => 53, CcFilesPeer::CONTRIBUTOR => 54, CcFilesPeer::LANGUAGE => 55, CcFilesPeer::FILE_EXISTS => 56, CcFilesPeer::SOUNDCLOUD_ID => 57, CcFilesPeer::SOUNDCLOUD_ERROR_CODE => 58, CcFilesPeer::SOUNDCLOUD_ERROR_MSG => 59, CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE => 60, CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME => 61, CcFilesPeer::REPLAY_GAIN => 62, CcFilesPeer::OWNER_ID => 63, CcFilesPeer::CUEIN => 64, CcFilesPeer::CUEOUT => 65, CcFilesPeer::SILAN_CHECK => 66, CcFilesPeer::HIDDEN => 67, CcFilesPeer::IS_SCHEDULED => 68, CcFilesPeer::IS_PLAYLIST => 69, CcFilesPeer::FILESIZE => 70, CcFilesPeer::DESCRIPTION => 71, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'IMPORT_STATUS' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, 'CUEIN' => 64, 'CUEOUT' => 65, 'SILAN_CHECK' => 66, 'HIDDEN' => 67, 'IS_SCHEDULED' => 68, 'IS_PLAYLIST' => 69, 'FILESIZE' => 70, 'DESCRIPTION' => 71, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'import_status' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, 'cuein' => 64, 'cueout' => 65, 'silan_check' => 66, 'hidden' => 67, 'is_scheduled' => 68, 'is_playlist' => 69, 'filesize' => 70, 'description' => 71, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -429,6 +432,7 @@ abstract class BaseCcFilesPeer
|
|||
$criteria->addSelectColumn(CcFilesPeer::IS_SCHEDULED);
|
||||
$criteria->addSelectColumn(CcFilesPeer::IS_PLAYLIST);
|
||||
$criteria->addSelectColumn(CcFilesPeer::FILESIZE);
|
||||
$criteria->addSelectColumn(CcFilesPeer::DESCRIPTION);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.id');
|
||||
$criteria->addSelectColumn($alias . '.name');
|
||||
|
@ -501,6 +505,7 @@ abstract class BaseCcFilesPeer
|
|||
$criteria->addSelectColumn($alias . '.is_scheduled');
|
||||
$criteria->addSelectColumn($alias . '.is_playlist');
|
||||
$criteria->addSelectColumn($alias . '.filesize');
|
||||
$criteria->addSelectColumn($alias . '.description');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -726,6 +731,9 @@ abstract class BaseCcFilesPeer
|
|||
// Invalidate objects in ThirdPartyTrackReferencesPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
ThirdPartyTrackReferencesPeer::clearInstancePool();
|
||||
// Invalidate objects in PodcastEpisodesPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
PodcastEpisodesPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
* @method CcFilesQuery orderByDbIsScheduled($order = Criteria::ASC) Order by the is_scheduled column
|
||||
* @method CcFilesQuery orderByDbIsPlaylist($order = Criteria::ASC) Order by the is_playlist column
|
||||
* @method CcFilesQuery orderByDbFilesize($order = Criteria::ASC) Order by the filesize column
|
||||
* @method CcFilesQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
|
||||
*
|
||||
* @method CcFilesQuery groupByDbId() Group by the id column
|
||||
* @method CcFilesQuery groupByDbName() Group by the name column
|
||||
|
@ -149,6 +150,7 @@
|
|||
* @method CcFilesQuery groupByDbIsScheduled() Group by the is_scheduled column
|
||||
* @method CcFilesQuery groupByDbIsPlaylist() Group by the is_playlist column
|
||||
* @method CcFilesQuery groupByDbFilesize() Group by the filesize column
|
||||
* @method CcFilesQuery groupByDbDescription() Group by the description column
|
||||
*
|
||||
* @method CcFilesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
|
@ -194,6 +196,10 @@
|
|||
* @method CcFilesQuery rightJoinThirdPartyTrackReferences($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ThirdPartyTrackReferences relation
|
||||
* @method CcFilesQuery innerJoinThirdPartyTrackReferences($relationAlias = null) Adds a INNER JOIN clause to the query using the ThirdPartyTrackReferences relation
|
||||
*
|
||||
* @method CcFilesQuery leftJoinPodcastEpisodes($relationAlias = null) Adds a LEFT JOIN clause to the query using the PodcastEpisodes relation
|
||||
* @method CcFilesQuery rightJoinPodcastEpisodes($relationAlias = null) Adds a RIGHT JOIN clause to the query using the PodcastEpisodes relation
|
||||
* @method CcFilesQuery innerJoinPodcastEpisodes($relationAlias = null) Adds a INNER JOIN clause to the query using the PodcastEpisodes relation
|
||||
*
|
||||
* @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
|
||||
* @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
|
||||
*
|
||||
|
@ -267,6 +273,7 @@
|
|||
* @method CcFiles findOneByDbIsScheduled(boolean $is_scheduled) Return the first CcFiles filtered by the is_scheduled column
|
||||
* @method CcFiles findOneByDbIsPlaylist(boolean $is_playlist) Return the first CcFiles filtered by the is_playlist column
|
||||
* @method CcFiles findOneByDbFilesize(int $filesize) Return the first CcFiles filtered by the filesize column
|
||||
* @method CcFiles findOneByDbDescription(string $description) Return the first CcFiles filtered by the description column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcFiles objects filtered by the id column
|
||||
* @method array findByDbName(string $name) Return CcFiles objects filtered by the name column
|
||||
|
@ -339,6 +346,7 @@
|
|||
* @method array findByDbIsScheduled(boolean $is_scheduled) Return CcFiles objects filtered by the is_scheduled column
|
||||
* @method array findByDbIsPlaylist(boolean $is_playlist) Return CcFiles objects filtered by the is_playlist column
|
||||
* @method array findByDbFilesize(int $filesize) Return CcFiles objects filtered by the filesize column
|
||||
* @method array findByDbDescription(string $description) Return CcFiles objects filtered by the description column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
|
@ -446,7 +454,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
|||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT "id", "name", "mime", "ftype", "directory", "filepath", "import_status", "currentlyaccessing", "editedby", "mtime", "utime", "lptime", "md5", "track_title", "artist_name", "bit_rate", "sample_rate", "format", "length", "album_title", "genre", "comments", "year", "track_number", "channels", "url", "bpm", "rating", "encoded_by", "disc_number", "mood", "label", "composer", "encoder", "checksum", "lyrics", "orchestra", "conductor", "lyricist", "original_lyricist", "radio_station_name", "info_url", "artist_url", "audio_source_url", "radio_station_url", "buy_this_url", "isrc_number", "catalog_number", "original_artist", "copyright", "report_datetime", "report_location", "report_organization", "subject", "contributor", "language", "file_exists", "soundcloud_id", "soundcloud_error_code", "soundcloud_error_msg", "soundcloud_link_to_file", "soundcloud_upload_time", "replay_gain", "owner_id", "cuein", "cueout", "silan_check", "hidden", "is_scheduled", "is_playlist", "filesize" FROM "cc_files" WHERE "id" = :p0';
|
||||
$sql = 'SELECT "id", "name", "mime", "ftype", "directory", "filepath", "import_status", "currentlyaccessing", "editedby", "mtime", "utime", "lptime", "md5", "track_title", "artist_name", "bit_rate", "sample_rate", "format", "length", "album_title", "genre", "comments", "year", "track_number", "channels", "url", "bpm", "rating", "encoded_by", "disc_number", "mood", "label", "composer", "encoder", "checksum", "lyrics", "orchestra", "conductor", "lyricist", "original_lyricist", "radio_station_name", "info_url", "artist_url", "audio_source_url", "radio_station_url", "buy_this_url", "isrc_number", "catalog_number", "original_artist", "copyright", "report_datetime", "report_location", "report_organization", "subject", "contributor", "language", "file_exists", "soundcloud_id", "soundcloud_error_code", "soundcloud_error_msg", "soundcloud_link_to_file", "soundcloud_upload_time", "replay_gain", "owner_id", "cuein", "cueout", "silan_check", "hidden", "is_scheduled", "is_playlist", "filesize", "description" FROM "cc_files" WHERE "id" = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
|
@ -2841,6 +2849,35 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcFilesPeer::FILESIZE, $dbFilesize, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the description column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue'
|
||||
* $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,482 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'imported_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ImportedPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column
|
||||
* @method ImportedPodcastQuery orderByDbAutoIngest($order = Criteria::ASC) Order by the auto_ingest column
|
||||
* @method ImportedPodcastQuery orderByDbAutoIngestTimestamp($order = Criteria::ASC) Order by the auto_ingest_timestamp column
|
||||
* @method ImportedPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column
|
||||
*
|
||||
* @method ImportedPodcastQuery groupByDbId() Group by the id column
|
||||
* @method ImportedPodcastQuery groupByDbAutoIngest() Group by the auto_ingest column
|
||||
* @method ImportedPodcastQuery groupByDbAutoIngestTimestamp() Group by the auto_ingest_timestamp column
|
||||
* @method ImportedPodcastQuery groupByDbPodcastId() Group by the podcast_id column
|
||||
*
|
||||
* @method ImportedPodcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ImportedPodcastQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ImportedPodcastQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ImportedPodcastQuery leftJoinPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the Podcast relation
|
||||
* @method ImportedPodcastQuery rightJoinPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Podcast relation
|
||||
* @method ImportedPodcastQuery innerJoinPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the Podcast relation
|
||||
*
|
||||
* @method ImportedPodcast findOne(PropelPDO $con = null) Return the first ImportedPodcast matching the query
|
||||
* @method ImportedPodcast findOneOrCreate(PropelPDO $con = null) Return the first ImportedPodcast matching the query, or a new ImportedPodcast object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ImportedPodcast findOneByDbAutoIngest(boolean $auto_ingest) Return the first ImportedPodcast filtered by the auto_ingest column
|
||||
* @method ImportedPodcast findOneByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return the first ImportedPodcast filtered by the auto_ingest_timestamp column
|
||||
* @method ImportedPodcast findOneByDbPodcastId(int $podcast_id) Return the first ImportedPodcast filtered by the podcast_id column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return ImportedPodcast objects filtered by the id column
|
||||
* @method array findByDbAutoIngest(boolean $auto_ingest) Return ImportedPodcast objects filtered by the auto_ingest column
|
||||
* @method array findByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return ImportedPodcast objects filtered by the auto_ingest_timestamp column
|
||||
* @method array findByDbPodcastId(int $podcast_id) Return ImportedPodcast objects filtered by the podcast_id column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
abstract class BaseImportedPodcastQuery extends ModelCriteria
|
||||
{
|
||||
/**
|
||||
* Initializes internal state of BaseImportedPodcastQuery object.
|
||||
*
|
||||
* @param string $dbName The dabase name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
||||
{
|
||||
if (null === $dbName) {
|
||||
$dbName = 'airtime';
|
||||
}
|
||||
if (null === $modelName) {
|
||||
$modelName = 'ImportedPodcast';
|
||||
}
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ImportedPodcastQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param ImportedPodcastQuery|Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ImportedPodcastQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof ImportedPodcastQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new ImportedPodcastQuery(null, null, $modelAlias);
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @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
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* </code>
|
||||
* @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:
|
||||
* <code>
|
||||
* $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
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $query->filterByDbAutoIngest(true); // WHERE auto_ingest = true
|
||||
* $query->filterByDbAutoIngest('yes'); // WHERE auto_ingest = true
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $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'
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $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
|
||||
* </code>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,645 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'podcast_episodes' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method PodcastEpisodesQuery orderByDbId($order = Criteria::ASC) Order by the id column
|
||||
* @method PodcastEpisodesQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
|
||||
* @method PodcastEpisodesQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column
|
||||
* @method PodcastEpisodesQuery orderByDbPublicationDate($order = Criteria::ASC) Order by the publication_date column
|
||||
* @method PodcastEpisodesQuery orderByDbDownloadUrl($order = Criteria::ASC) Order by the download_url column
|
||||
* @method PodcastEpisodesQuery orderByDbEpisodeGuid($order = Criteria::ASC) Order by the episode_guid column
|
||||
*
|
||||
* @method PodcastEpisodesQuery groupByDbId() Group by the id column
|
||||
* @method PodcastEpisodesQuery groupByDbFileId() Group by the file_id column
|
||||
* @method PodcastEpisodesQuery groupByDbPodcastId() Group by the podcast_id column
|
||||
* @method PodcastEpisodesQuery groupByDbPublicationDate() Group by the publication_date column
|
||||
* @method PodcastEpisodesQuery groupByDbDownloadUrl() Group by the download_url column
|
||||
* @method PodcastEpisodesQuery groupByDbEpisodeGuid() Group by the episode_guid column
|
||||
*
|
||||
* @method PodcastEpisodesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method PodcastEpisodesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method PodcastEpisodesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method PodcastEpisodesQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
|
||||
* @method PodcastEpisodesQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
|
||||
* @method PodcastEpisodesQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
|
||||
*
|
||||
* @method PodcastEpisodesQuery leftJoinPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the Podcast relation
|
||||
* @method PodcastEpisodesQuery rightJoinPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Podcast relation
|
||||
* @method PodcastEpisodesQuery innerJoinPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the Podcast relation
|
||||
*
|
||||
* @method PodcastEpisodes findOne(PropelPDO $con = null) Return the first PodcastEpisodes matching the query
|
||||
* @method PodcastEpisodes findOneOrCreate(PropelPDO $con = null) Return the first PodcastEpisodes matching the query, or a new PodcastEpisodes object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method PodcastEpisodes findOneByDbFileId(int $file_id) Return the first PodcastEpisodes filtered by the file_id column
|
||||
* @method PodcastEpisodes findOneByDbPodcastId(int $podcast_id) Return the first PodcastEpisodes filtered by the podcast_id column
|
||||
* @method PodcastEpisodes findOneByDbPublicationDate(string $publication_date) Return the first PodcastEpisodes filtered by the publication_date column
|
||||
* @method PodcastEpisodes findOneByDbDownloadUrl(string $download_url) Return the first PodcastEpisodes filtered by the download_url column
|
||||
* @method PodcastEpisodes findOneByDbEpisodeGuid(string $episode_guid) Return the first PodcastEpisodes filtered by the episode_guid column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return PodcastEpisodes objects filtered by the id column
|
||||
* @method array findByDbFileId(int $file_id) Return PodcastEpisodes objects filtered by the file_id column
|
||||
* @method array findByDbPodcastId(int $podcast_id) Return PodcastEpisodes objects filtered by the podcast_id column
|
||||
* @method array findByDbPublicationDate(string $publication_date) Return PodcastEpisodes objects filtered by the publication_date column
|
||||
* @method array findByDbDownloadUrl(string $download_url) Return PodcastEpisodes objects filtered by the download_url column
|
||||
* @method array findByDbEpisodeGuid(string $episode_guid) Return PodcastEpisodes objects filtered by the episode_guid column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
abstract class BasePodcastEpisodesQuery extends ModelCriteria
|
||||
{
|
||||
/**
|
||||
* Initializes internal state of BasePodcastEpisodesQuery object.
|
||||
*
|
||||
* @param string $dbName The dabase name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
||||
{
|
||||
if (null === $dbName) {
|
||||
$dbName = 'airtime';
|
||||
}
|
||||
if (null === $modelName) {
|
||||
$modelName = 'PodcastEpisodes';
|
||||
}
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new PodcastEpisodesQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param PodcastEpisodesQuery|Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return PodcastEpisodesQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof PodcastEpisodesQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new PodcastEpisodesQuery(null, null, $modelAlias);
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @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
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* </code>
|
||||
* @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:
|
||||
* <code>
|
||||
* $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
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $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
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $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
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $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'
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $query->filterByDbDownloadUrl('fooValue'); // WHERE download_url = 'fooValue'
|
||||
* $query->filterByDbDownloadUrl('%fooValue%'); // WHERE download_url LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $query->filterByDbEpisodeGuid('fooValue'); // WHERE episode_guid = 'fooValue'
|
||||
* $query->filterByDbEpisodeGuid('%fooValue%'); // WHERE episode_guid LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,959 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base class that represents a row from the 'station_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
abstract class BaseStationPodcast extends BaseObject implements Persistent
|
||||
{
|
||||
/**
|
||||
* Peer class name
|
||||
*/
|
||||
const PEER = 'StationPodcastPeer';
|
||||
|
||||
/**
|
||||
* The Peer class.
|
||||
* Instance provides a convenient way of calling static methods on a class
|
||||
* that calling code may not be able to identify.
|
||||
* @var StationPodcastPeer
|
||||
*/
|
||||
protected static $peer;
|
||||
|
||||
/**
|
||||
* The flag var to prevent infinite loop in deep copy
|
||||
* @var boolean
|
||||
*/
|
||||
protected $startCopy = false;
|
||||
|
||||
/**
|
||||
* The value for the id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the podcast_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $podcast_id;
|
||||
|
||||
/**
|
||||
* @var Podcast
|
||||
*/
|
||||
protected $aPodcast;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless validation loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInClearAllReferencesDeep = false;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbId()
|
||||
{
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [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 <code>true</code> is returned; otherwise
|
||||
* an aggregated array of ValidationFailed objects will be returned.
|
||||
*
|
||||
* @param array $columns Array of column names to validate.
|
||||
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> 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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,999 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'station_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
abstract class BaseStationPodcastPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'airtime';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'station_podcast';
|
||||
|
||||
/** the related Propel class for this table */
|
||||
const OM_CLASS = 'StationPodcast';
|
||||
|
||||
/** the related TableMap class for this table */
|
||||
const TM_CLASS = 'StationPodcastTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
||||
const NUM_HYDRATE_COLUMNS = 2;
|
||||
|
||||
/** the column name for the id field */
|
||||
const ID = 'station_podcast.id';
|
||||
|
||||
/** the column name for the podcast_id field */
|
||||
const PODCAST_ID = 'station_podcast.podcast_id';
|
||||
|
||||
/** The default string format for model objects of the related table **/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* An identity map to hold any loaded instances of StationPodcast objects.
|
||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||
* queries.
|
||||
* @var array StationPodcast[]
|
||||
*/
|
||||
public static $instances = array();
|
||||
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. StationPodcastPeer::$fieldNames[StationPodcastPeer::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => 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.
|
||||
* <code>
|
||||
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||
* </code>
|
||||
* @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();
|
||||
|
|
@ -0,0 +1,404 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'station_podcast' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method StationPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column
|
||||
* @method StationPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column
|
||||
*
|
||||
* @method StationPodcastQuery groupByDbId() Group by the id column
|
||||
* @method StationPodcastQuery groupByDbPodcastId() Group by the podcast_id column
|
||||
*
|
||||
* @method StationPodcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method StationPodcastQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method StationPodcastQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method StationPodcastQuery leftJoinPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the Podcast relation
|
||||
* @method StationPodcastQuery rightJoinPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Podcast relation
|
||||
* @method StationPodcastQuery innerJoinPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the Podcast relation
|
||||
*
|
||||
* @method StationPodcast findOne(PropelPDO $con = null) Return the first StationPodcast matching the query
|
||||
* @method StationPodcast findOneOrCreate(PropelPDO $con = null) Return the first StationPodcast matching the query, or a new StationPodcast object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method StationPodcast findOneByDbPodcastId(int $podcast_id) Return the first StationPodcast filtered by the podcast_id column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return StationPodcast objects filtered by the id column
|
||||
* @method array findByDbPodcastId(int $podcast_id) Return StationPodcast objects filtered by the podcast_id column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
abstract class BaseStationPodcastQuery extends ModelCriteria
|
||||
{
|
||||
/**
|
||||
* Initializes internal state of BaseStationPodcastQuery object.
|
||||
*
|
||||
* @param string $dbName The dabase name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
|
||||
{
|
||||
if (null === $dbName) {
|
||||
$dbName = 'airtime';
|
||||
}
|
||||
if (null === $modelName) {
|
||||
$modelName = 'StationPodcast';
|
||||
}
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new StationPodcastQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param StationPodcastQuery|Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return StationPodcastQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof StationPodcastQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new StationPodcastQuery(null, null, $modelAlias);
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @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
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* </code>
|
||||
* @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:
|
||||
* <code>
|
||||
* $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
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* $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
|
||||
* </code>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once 'RouteController.php';
|
||||
|
||||
class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
|
||||
{
|
||||
protected function _initRouter()
|
||||
|
@ -8,9 +10,54 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
|
|||
$router = $front->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/(?<id>\d+)/download/(?<download_key>.+)\.(?<file_ext>\w+)',
|
||||
array(
|
||||
'controller' => 'media',
|
||||
'action' => 'download',
|
||||
'module' => 'rest'
|
||||
),
|
||||
array(
|
||||
1 => "id",
|
||||
2 => "download_key",
|
||||
3 => "file_ext"
|
||||
)
|
||||
);
|
||||
$router->addRoute('podcast-episode-download', $podcastEpisodeDownloadRoute);
|
||||
|
||||
$clearLibraryRoute = new Zend_Controller_Router_Route(
|
||||
'rest/media/clear',
|
||||
array(
|
||||
|
@ -34,5 +96,31 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
|
|||
)
|
||||
);
|
||||
$router->addRoute('clear', $clearLibraryRoute);
|
||||
|
||||
$publishRoute = new Zend_Controller_Router_Route(
|
||||
'rest/media/:id/publish',
|
||||
array(
|
||||
'controller' => 'media',
|
||||
'action' => 'publish',
|
||||
'module' => 'rest'
|
||||
),
|
||||
array(
|
||||
'id' => '\d+'
|
||||
)
|
||||
);
|
||||
$router->addRoute('publish', $publishRoute);
|
||||
|
||||
$publishSourcesRoute = new Zend_Controller_Router_Route(
|
||||
'rest/media/:id/publish-sources',
|
||||
array(
|
||||
'controller' => 'media',
|
||||
'action' => 'publish-sources',
|
||||
'module' => 'rest'
|
||||
),
|
||||
array(
|
||||
'id' => '\d+'
|
||||
)
|
||||
);
|
||||
$router->addRoute('publish-sources', $publishSourcesRoute);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,13 +21,20 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
$offset = $this->_getParam('offset', 0);
|
||||
$limit = $this->_getParam('limit', $totalFileCount);
|
||||
|
||||
//Sorting parameters
|
||||
$sortColumn = $this->_getParam('sort', CcFilesPeer::ID);
|
||||
$sortDir = $this->_getParam('sort_dir', Criteria::ASC);
|
||||
|
||||
$query = CcFilesQuery::create()
|
||||
->filterByDbHidden(false)
|
||||
->filterByDbFileExists(true)
|
||||
->filterByDbImportStatus(0)
|
||||
->setLimit($limit)
|
||||
->setOffset($offset)
|
||||
->orderByDbId();
|
||||
->orderBy($sortColumn, $sortDir);
|
||||
//->orderByDbId();
|
||||
|
||||
|
||||
$queryCount = $query->count();
|
||||
$queryResult = $query->find();
|
||||
|
||||
|
@ -39,7 +46,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->setHeader('X-TOTAL-COUNT', $queryCount)
|
||||
->setHeader('X-TOTAL-COUNT', $totalFileCount)
|
||||
->appendBody(json_encode($files_array));
|
||||
|
||||
/** TODO: Use this simpler code instead after we upgrade to Propel 1.7 (Airtime 2.6.x branch):
|
||||
|
@ -56,11 +63,17 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// In case the download fails
|
||||
$counterIncremented = false;
|
||||
try {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200);
|
||||
$inline = false;
|
||||
// SAAS-1081 - download counter for station podcast downloads
|
||||
if ($key = $this->getRequest()->getParam("download_key", false)) {
|
||||
Application_Model_Preference::incrementStationPodcastDownloadCounter();
|
||||
$counterIncremented = true;
|
||||
}
|
||||
Application_Service_MediaService::streamFileDownload($id, $inline);
|
||||
}
|
||||
catch (FileNotFoundException $e) {
|
||||
|
@ -68,6 +81,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
Logging::error($e->getMessage());
|
||||
}
|
||||
catch (Exception $e) {
|
||||
if ($counterIncremented) Application_Model_Preference::decrementStationPodcastDownloadCounter();
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
|
@ -122,9 +136,8 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
->appendBody("ERROR: Disk Quota reached.");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
throw $e;
|
||||
$this->serviceUnavailableResponse();
|
||||
Logging::error($e->getMessage() . "\n" . $e->getTraceAsString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,6 +191,32 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish endpoint for individual media items
|
||||
*/
|
||||
public function publishAction() {
|
||||
$id = $this->getId();
|
||||
try {
|
||||
// Is there a better way to do this?
|
||||
$data = json_decode($this->getRequest()->getRawBody(), true)["sources"];
|
||||
Application_Service_PublishService::publish($id, $data);
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200);
|
||||
} catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function publishSourcesAction() {
|
||||
$id = $this->_getParam('id', false);
|
||||
$sources = Application_Service_PublishService::getSourceLists($id);
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody(json_encode($sources));
|
||||
|
||||
}
|
||||
|
||||
private function getId()
|
||||
{
|
||||
if (!$id = $this->_getParam('id', false)) {
|
||||
|
@ -209,5 +248,12 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("An unknown error occurred.");
|
||||
}
|
||||
|
||||
private function serviceUnavailableResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("An error occurred while processing your upload. Please try again in a few minutes.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,234 @@
|
|||
<?php
|
||||
|
||||
require_once('PodcastFactory.php');
|
||||
|
||||
class Rest_PodcastController extends Zend_Rest_Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
|
||||
// Remove reliance on .phtml files to render requests
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$this->view->setScriptPath(APPLICATION_PATH . 'views/scripts/');
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$totalPodcastCount = PodcastQuery::create()->count();
|
||||
|
||||
// Check if offset and limit were sent with request.
|
||||
// Default limit to zero and offset to $totalFileCount
|
||||
$offset = $this->_getParam('offset', 0);
|
||||
$limit = $this->_getParam('limit', $totalPodcastCount);
|
||||
|
||||
//Sorting parameters
|
||||
$sortColumn = $this->_getParam('sort', PodcastPeer::ID);
|
||||
$sortDir = $this->_getParam('sort_dir', Criteria::ASC);
|
||||
|
||||
$stationPodcastId = Application_Model_Preference::getStationPodcastId();
|
||||
$query = PodcastQuery::create()
|
||||
// Don't return the Station podcast - we fetch it separately
|
||||
->filterByDbId($stationPodcastId, Criteria::NOT_EQUAL)
|
||||
->setLimit($limit)
|
||||
->setOffset($offset)
|
||||
->orderBy($sortColumn, $sortDir);
|
||||
|
||||
$queryResult = $query->find();
|
||||
|
||||
$podcastArray = array();
|
||||
foreach ($queryResult as $podcast)
|
||||
{
|
||||
array_push($podcastArray, $podcast->toArray(BasePeer::TYPE_FIELDNAME));
|
||||
}
|
||||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->setHeader('X-TOTAL-COUNT', $totalPodcastCount)
|
||||
->appendBody(json_encode($podcastArray));
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody(json_encode(Application_Service_PodcastService::getPodcastById($id)));
|
||||
} catch (PodcastNotFoundException $e) {
|
||||
$this->podcastNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function postAction()
|
||||
{
|
||||
//If we do get an ID on a POST, then that doesn't make any sense
|
||||
//since POST is only for creating.
|
||||
if ($id = $this->_getParam('id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: ID should not be specified when using POST. POST is only used for podcast creation, and an ID will be chosen by Airtime");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$requestData = $this->getRequest()->getPost();
|
||||
$podcast = Application_Service_PodcastService::createFromFeedUrl($requestData["url"]);
|
||||
|
||||
$path = 'podcast/podcast.phtml';
|
||||
|
||||
$this->view->podcast = $podcast;
|
||||
$this->_helper->json->sendJson(array(
|
||||
"podcast"=>json_encode($podcast),
|
||||
"html"=>$this->view->render($path),
|
||||
));
|
||||
}
|
||||
catch (PodcastLimitReachedException $e) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody("Podcast limit reached.");
|
||||
}
|
||||
catch (InvalidPodcastException $e) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody("Invalid podcast!");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::error($e->getMessage());
|
||||
$this->unknownErrorResponse();
|
||||
}
|
||||
}
|
||||
|
||||
public function putAction()
|
||||
{
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
$podcast = Application_Service_PodcastService::updatePodcastFromArray($id, $requestData);
|
||||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->appendBody(json_encode($podcast));
|
||||
}
|
||||
catch (PodcastNotFoundException $e) {
|
||||
$this->podcastNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Application_Service_PodcastService::deletePodcastById($id);
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(204);
|
||||
}
|
||||
catch (PodcastNotFoundException $e) {
|
||||
$this->podcastNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Endpoint for performing bulk actions (deleting multiple podcasts, opening multiple editors)
|
||||
*/
|
||||
public function bulkAction() {
|
||||
if ($this->_request->getMethod() != HttpRequestType::POST) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(405)
|
||||
->appendBody("ERROR: Method not accepted");
|
||||
return;
|
||||
}
|
||||
|
||||
$ids = $this->_getParam('ids', []);
|
||||
$method = $this->_getParam('method', HttpRequestType::GET);
|
||||
$responseBody = [];
|
||||
|
||||
// XXX: Should this be a map of HttpRequestType => function call instead? Would be a bit cleaner
|
||||
switch($method) {
|
||||
case HttpRequestType::DELETE:
|
||||
foreach($ids as $id) {
|
||||
Application_Service_PodcastService::deletePodcastById($id);
|
||||
}
|
||||
break;
|
||||
case HttpRequestType::GET:
|
||||
$path = 'podcast/podcast.phtml';
|
||||
foreach($ids as $id) {
|
||||
$responseBody[] = array(
|
||||
"podcast" => json_encode(Application_Service_PodcastService::getPodcastById($id)),
|
||||
"html" => $this->view->render($path)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->_helper->json->sendJson($responseBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws PodcastNotFoundException
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function stationAction() {
|
||||
$stationPodcastId = Application_Model_Preference::getStationPodcastId();
|
||||
$podcast = Application_Service_PodcastService::getPodcastById($stationPodcastId);
|
||||
$path = 'podcast/station.phtml';
|
||||
$this->view->podcast = $podcast;
|
||||
$this->_helper->json->sendJson(array(
|
||||
"podcast" => json_encode($podcast),
|
||||
"html" => $this->view->render($path)
|
||||
));
|
||||
}
|
||||
|
||||
private function getId()
|
||||
{
|
||||
if (!$id = $this->_getParam('id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: No podcast ID specified.");
|
||||
return false;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function unknownErrorResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(500);
|
||||
$resp->appendBody("An unknown error occurred.");
|
||||
}
|
||||
|
||||
private function podcastNotFoundResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(404);
|
||||
$resp->appendBody("ERROR: Podcast not found.");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
<?php
|
||||
|
||||
class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Application_Service_PodcastEpisodeService
|
||||
*/
|
||||
protected $_service;
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
|
||||
// Remove reliance on .phtml files to render requests
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$this->_service = new Application_Service_PodcastEpisodeService();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
// podcast ID
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
$totalPodcastEpisodesCount = PodcastEpisodesQuery::create()
|
||||
->filterByDbPodcastId($id)
|
||||
->count();
|
||||
|
||||
// Check if offset and limit were sent with request.
|
||||
// Default limit to zero and offset to $totalFileCount
|
||||
$offset = $this->_getParam('offset', 0);
|
||||
$limit = $this->_getParam('limit', $totalPodcastEpisodesCount);
|
||||
|
||||
//Sorting parameters
|
||||
$sortColumn = $this->_getParam('sort', PodcastEpisodesPeer::ID);
|
||||
$sortDir = $this->_getParam('sort_dir', Criteria::ASC);
|
||||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->setHeader('X-TOTAL-COUNT', $totalPodcastEpisodesCount)
|
||||
->appendBody(json_encode($this->_service->getPodcastEpisodes($id, $offset, $limit, $sortColumn, $sortDir)));
|
||||
|
||||
} catch (PodcastNotFoundException $e) {
|
||||
$this->podcastNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
// podcast ID
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
$episodeId = $this->getEpisodeId();
|
||||
if (!$episodeId) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->appendBody(json_encode($this->_service->getPodcastEpisodeById($episodeId)));
|
||||
|
||||
} catch (PodcastNotFoundException $e) {
|
||||
$this->podcastNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
} catch (PodcastEpisodeNotFoundException $e) {
|
||||
$this->podcastEpisodeNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function postAction()
|
||||
{
|
||||
//If we do get an episode ID on a POST, then that doesn't make any sense
|
||||
//since POST is only for creating.
|
||||
if ($episodeId = $this->_getParam('episode_id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: Episode ID should not be specified when using POST. POST is only used for "
|
||||
. "importing podcast episodes, and an episode ID will be chosen by Airtime");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure a podcast ID was specified
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
$episode = $this->_service->importEpisode($id, $requestData["episode"]);
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->appendBody(json_encode($episode));
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
$episodeId = $this->getEpisodeId();
|
||||
if (!$episodeId) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->_service->deletePodcastEpisodeById($episodeId);
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(204);
|
||||
} catch (PodcastEpisodeNotFoundException $e) {
|
||||
$this->podcastEpisodeNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function putAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function getId()
|
||||
{
|
||||
if (!$id = $this->_getParam('id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: No podcast ID specified.");
|
||||
return false;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function getEpisodeId()
|
||||
{
|
||||
if (!$episodeId = $this->_getParam('episode_id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: No podcast episode ID specified.");
|
||||
return false;
|
||||
}
|
||||
return $episodeId;
|
||||
}
|
||||
|
||||
private function unknownErrorResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("An unknown error occurred.");
|
||||
}
|
||||
|
||||
private function podcastNotFoundResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(404);
|
||||
$resp->appendBody("ERROR: Podcast not found.");
|
||||
}
|
||||
|
||||
private function podcastEpisodeNotFoundResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(404);
|
||||
$resp->appendBody("ERROR: Podcast episode not found.");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Class Rest_RouteController
|
||||
*
|
||||
* Taken from https://github.com/aporat/Application_Rest_Controller_Route
|
||||
* to enable hierarchy routing
|
||||
*/
|
||||
|
||||
class Rest_RouteController extends Zend_Controller_Router_Route
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Zend_Controller_Front
|
||||
*/
|
||||
protected $_front;
|
||||
|
||||
protected $_actionKey = 'action';
|
||||
|
||||
/**
|
||||
* Prepares the route for mapping by splitting (exploding) it
|
||||
* to a corresponding atomic parts. These parts are assigned
|
||||
* a position which is later used for matching and preparing values.
|
||||
*
|
||||
* @param Zend_Controller_Front $front Front Controller object
|
||||
* @param string $route Map used to match with later submitted URL path
|
||||
* @param array $defaults Defaults for map variables with keys as variable names
|
||||
* @param array $reqs Regular expression requirements for variables (keys as variable names)
|
||||
* @param Zend_Translate $translator Translator to use for this instance
|
||||
*/
|
||||
public function __construct(Zend_Controller_Front $front, $route, $defaults = array(), $reqs = array(), Zend_Translate $translator = null, $locale = null)
|
||||
{
|
||||
$this->_front = $front;
|
||||
$this->_dispatcher = $front->getDispatcher();
|
||||
|
||||
parent::__construct($route, $defaults, $reqs, $translator, $locale);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Matches a user submitted path with parts defined by a map. Assigns and
|
||||
* returns an array of variables on a successful match.
|
||||
*
|
||||
* @param string $path Path used to match against this routing map
|
||||
* @return array|false An array of assigned values or a false on a mismatch
|
||||
*/
|
||||
public function match($path, $partial = false)
|
||||
{
|
||||
|
||||
|
||||
$return = parent::match($path, $partial);
|
||||
|
||||
// add the RESTful action mapping
|
||||
if ($return) {
|
||||
$request = $this->_front->getRequest();
|
||||
$path = $request->getPathInfo();
|
||||
$params = $request->getParams();
|
||||
|
||||
$path = trim($path, self::URI_DELIMITER);
|
||||
|
||||
if ($path != '') {
|
||||
$path = explode(self::URI_DELIMITER, $path);
|
||||
}
|
||||
|
||||
//Store path count for method mapping
|
||||
$pathElementCount = count($path);
|
||||
|
||||
// Determine Action
|
||||
$requestMethod = strtolower($request->getMethod());
|
||||
if ($requestMethod != 'get') {
|
||||
if ($request->getParam('_method')) {
|
||||
$return[$this->_actionKey] = strtolower($request->getParam('_method'));
|
||||
} elseif ( $request->getHeader('X-HTTP-Method-Override') ) {
|
||||
$return[$this->_actionKey] = strtolower($request->getHeader('X-HTTP-Method-Override'));
|
||||
} else {
|
||||
$return[$this->_actionKey] = $requestMethod;
|
||||
}
|
||||
|
||||
// Map PUT and POST to actual create/update actions
|
||||
// based on parameter count (posting to resource or collection)
|
||||
switch( $return[$this->_actionKey] ){
|
||||
case 'post':
|
||||
$return[$this->_actionKey] = 'post';
|
||||
break;
|
||||
case 'put':
|
||||
$return[$this->_actionKey] = 'put';
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
// if the last argument in the path is a numeric value, consider this request a GET of an item
|
||||
$lastParam = array_pop($path);
|
||||
if (is_numeric($lastParam)) {
|
||||
$return[$this->_actionKey] = 'get';
|
||||
} else {
|
||||
$return[$this->_actionKey] = 'index';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -3,18 +3,21 @@
|
|||
class CeleryServiceFactory {
|
||||
|
||||
/**
|
||||
*
|
||||
* Given an identifying string, get a ThirdPartyCeleryService object of that type
|
||||
*
|
||||
* @param $serviceName string the name of the service to create
|
||||
*
|
||||
* @return ThirdPartyCeleryService|null
|
||||
* @return Application_Service_ThirdPartyCeleryService|null
|
||||
*/
|
||||
public static function getService($serviceName) {
|
||||
switch($serviceName) {
|
||||
case SOUNDCLOUD_SERVICE_NAME:
|
||||
return new SoundcloudService();
|
||||
return new Application_Service_SoundcloudService();
|
||||
case PODCAST_SERVICE_NAME:
|
||||
return new Application_Service_PodcastEpisodeService();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,15 @@ require_once("FileIO.php");
|
|||
|
||||
class Application_Service_MediaService
|
||||
{
|
||||
|
||||
const PENDING_FILE_TIMEOUT_SECONDS = 3600;
|
||||
|
||||
/**
|
||||
* @var array store an internal array of the pending files so we don't have
|
||||
* to go to the database twice
|
||||
*/
|
||||
private static $_pendingFiles;
|
||||
|
||||
/** Move (or copy) a file to the stor/organize directory and send it off to the
|
||||
analyzer to be processed.
|
||||
* @param $callbackUrl
|
||||
|
@ -111,9 +120,31 @@ class Application_Service_MediaService
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 static function areFilesStuckInPending() {
|
||||
$oneHourAgo = gmdate(DEFAULT_TIMESTAMP_FORMAT, (microtime(true) - self::PENDING_FILE_TIMEOUT_SECONDS));
|
||||
self::$_pendingFiles = CcFilesQuery::create()
|
||||
->filterByDbImportStatus(CcFiles::IMPORT_STATUS_PENDING)
|
||||
->filterByDbUtime($oneHourAgo, Criteria::LESS_EQUAL)
|
||||
->find();
|
||||
return !empty(self::$_pendingFiles);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clean up stuck imports by changing their import status to Failed
|
||||
*/
|
||||
public static function clearStuckPendingImports() {
|
||||
foreach(self::$_pendingFiles as $file) {
|
||||
/** @var $file CcFiles */
|
||||
$file->setDbImportStatus(CcFiles::IMPORT_STATUS_FAILED)->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,401 @@
|
|||
<?php
|
||||
|
||||
class PodcastEpisodeNotFoundException extends Exception {}
|
||||
|
||||
class DuplicatePodcastEpisodeException extends Exception {}
|
||||
|
||||
class Application_Service_PodcastEpisodeService extends Application_Service_ThirdPartyCeleryService implements Publish
|
||||
{
|
||||
/**
|
||||
* Arbitrary constant identifiers for the internal tasks array
|
||||
*/
|
||||
|
||||
const DOWNLOAD = 'download';
|
||||
|
||||
/**
|
||||
* @var string service name to store in ThirdPartyTrackReferences database
|
||||
*/
|
||||
protected static $_SERVICE_NAME = PODCAST_SERVICE_NAME; // Service name constant from constants.php
|
||||
|
||||
/**
|
||||
* @var string exchange name for Podcast tasks
|
||||
*/
|
||||
protected static $_CELERY_EXCHANGE_NAME = 'podcast';
|
||||
|
||||
/**
|
||||
* @var array map of constant identifiers to Celery task names
|
||||
*/
|
||||
protected static $_CELERY_TASKS = [
|
||||
self::DOWNLOAD => 'podcast-download'
|
||||
];
|
||||
|
||||
private static $privateFields = array(
|
||||
"id"
|
||||
);
|
||||
|
||||
/**
|
||||
* Utility function to import and download a single episode
|
||||
*
|
||||
* @param int $podcastId ID of the podcast the episode should belong to
|
||||
* @param array $episode array of episode data to store
|
||||
*
|
||||
* @return PodcastEpisodes the stored PodcastEpisodes object
|
||||
*/
|
||||
public function importEpisode($podcastId, $episode) {
|
||||
$e = $this->addPlaceholder($podcastId, $episode);
|
||||
$this->_download($e->getDbId(), $e->getDbDownloadUrl());
|
||||
return $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of episodes, store them in the database as placeholder objects until
|
||||
* they can be processed by Celery
|
||||
*
|
||||
* @param int $podcastId Podcast object identifier
|
||||
* @param array $episodes array of podcast episodes
|
||||
*
|
||||
* @return array the stored PodcastEpisodes objects
|
||||
*/
|
||||
public function addPodcastEpisodePlaceholders($podcastId, $episodes) {
|
||||
$storedEpisodes = array();
|
||||
foreach ($episodes as $episode) {
|
||||
try {
|
||||
$e = $this->addPlaceholder($podcastId, $episode);
|
||||
} catch(DuplicatePodcastEpisodeException $ex) {
|
||||
Logging::warn($ex->getMessage());
|
||||
continue;
|
||||
}
|
||||
array_push($storedEpisodes, $e);
|
||||
}
|
||||
return $storedEpisodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an episode, store it in the database as a placeholder object until
|
||||
* it can be processed by Celery
|
||||
*
|
||||
* @param int $podcastId Podcast object identifier
|
||||
* @param array $episode array of podcast episode data
|
||||
*
|
||||
* @return PodcastEpisodes the stored PodcastEpisodes object
|
||||
*
|
||||
* @throws DuplicatePodcastEpisodeException
|
||||
*/
|
||||
public function addPlaceholder($podcastId, $episode) {
|
||||
$existingEpisode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episode["guid"]);
|
||||
if (!empty($existingEpisode)) {
|
||||
throw new DuplicatePodcastEpisodeException("Episode already exists: \n" . var_export($episode, true));
|
||||
}
|
||||
// We need to check whether the array is parsed directly from the SimplePie
|
||||
// feed object, or whether it's passed in as json
|
||||
$enclosure = $episode["enclosure"];
|
||||
$url = $enclosure instanceof SimplePie_Enclosure ? $enclosure->get_link() : $enclosure["link"];
|
||||
return $this->_buildEpisode($podcastId, $url, $episode["guid"], $episode["pub_date"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given episode parameters, construct and store a basic PodcastEpisodes object
|
||||
*
|
||||
* @param int $podcastId the podcast the episode belongs to
|
||||
* @param string $url the download URL for the episode
|
||||
* @param string $guid the unique id for the episode. Often the same as the download URL
|
||||
* @param string $publicationDate the publication date of the episode
|
||||
*
|
||||
* @return PodcastEpisodes the newly created PodcastEpisodes object
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws PropelException
|
||||
*/
|
||||
private function _buildEpisode($podcastId, $url, $guid, $publicationDate) {
|
||||
$e = new PodcastEpisodes();
|
||||
$e->setDbPodcastId($podcastId);
|
||||
$e->setDbDownloadUrl($url);
|
||||
$e->setDbEpisodeGuid($guid);
|
||||
$e->setDbPublicationDate($publicationDate);
|
||||
$e->save();
|
||||
return $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of episodes, extract the IDs and download URLs and send them to Celery
|
||||
*
|
||||
* @param array $episodes array of podcast episodes
|
||||
*/
|
||||
public function downloadEpisodes($episodes) {
|
||||
/** @var PodcastEpisodes $episode */
|
||||
foreach($episodes as $episode) {
|
||||
$this->_download($episode->getDbId(), $episode->getDbDownloadUrl());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an episode ID and a download URL, send a Celery task
|
||||
* to download an RSS feed track
|
||||
*
|
||||
* @param int $id episode unique ID
|
||||
* @param string $url download url for the episode
|
||||
*/
|
||||
private function _download($id, $url) {
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$data = array(
|
||||
'id' => $id,
|
||||
'url' => $url,
|
||||
'callback_url' => Application_Common_HTTPHelper::getStationUrl() . '/rest/media',
|
||||
'api_key' => $apiKey = $CC_CONFIG["apiKey"][0],
|
||||
);
|
||||
$this->_executeTask(static::$_CELERY_TASKS[self::DOWNLOAD], $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a ThirdPartyTrackReferences object for a completed upload
|
||||
*
|
||||
* @param $task CeleryTasks the completed CeleryTasks object
|
||||
* @param $episodeId int PodcastEpisodes identifier
|
||||
* @param $episode stdClass simple object containing Podcast episode information
|
||||
* @param $status string Celery task status
|
||||
*
|
||||
* @return ThirdPartyTrackReferences the updated ThirdPartyTrackReferences object
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function updateTrackReference($task, $episodeId, $episode, $status) {
|
||||
$ref = parent::updateTrackReference($task, $episodeId, $episode, $status);
|
||||
$dbEpisode = PodcastEpisodesQuery::create()->findOneByDbId($episode->episodeid);
|
||||
|
||||
try {
|
||||
// If the placeholder for the episode is somehow removed, return with a warning
|
||||
if (!$dbEpisode) {
|
||||
Logging::warn("Celery task $task episode $episode->episodeid unsuccessful: episode placeholder removed");
|
||||
return $ref;
|
||||
}
|
||||
|
||||
// Even if the task itself succeeds, the download could have failed, so check the status
|
||||
if ($status == CELERY_SUCCESS_STATUS && $episode->status == 1) {
|
||||
$dbEpisode->setDbFileId($episode->fileid)->save();
|
||||
} else {
|
||||
Logging::warn("Celery task $task episode $episode->episodeid unsuccessful with message $episode->error");
|
||||
$dbEpisode->delete();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$dbEpisode->delete();
|
||||
Logging::warn("Catastrophic failure updating from task $task, recovering by deleting episode row.\n
|
||||
This can occur if the episode's corresponding CcFile is deleted before being processed.");
|
||||
}
|
||||
|
||||
return $ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish the file with the given file ID to the station podcast
|
||||
*
|
||||
* @param int $fileId ID of the file to be published
|
||||
*/
|
||||
public function publish($fileId) {
|
||||
$id = Application_Model_Preference::getStationPodcastId();
|
||||
$url = $guid = Application_Common_HTTPHelper::getStationUrl()."rest/media/$fileId/download";
|
||||
if (!PodcastEpisodesQuery::create()
|
||||
->filterByDbPodcastId($id)
|
||||
->findOneByDbFileId($fileId)) { // Don't allow duplicate episodes
|
||||
$e = $this->_buildEpisode($id, $url, $guid, date('r'));
|
||||
$e->setDbFileId($fileId)->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpublish the file with the given file ID from the station podcast
|
||||
*
|
||||
* @param int $fileId ID of the file to be unpublished
|
||||
*/
|
||||
public function unpublish($fileId) {
|
||||
$id = Application_Model_Preference::getStationPodcastId();
|
||||
PodcastEpisodesQuery::create()
|
||||
->filterByDbPodcastId($id)
|
||||
->findOneByDbFileId($fileId)
|
||||
->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the publication status for the file with the given ID
|
||||
*
|
||||
* @param int $fileId the ID of the file to check
|
||||
*
|
||||
* @return int 1 if the file has been published,
|
||||
* 0 if the file has yet to be published,
|
||||
* -1 if the file is in a pending state,
|
||||
* 2 if the source is unreachable (disconnected)
|
||||
*/
|
||||
public function getPublishStatus($fileId) {
|
||||
$stationPodcast = StationPodcastQuery::create()
|
||||
->findOneByDbPodcastId(Application_Model_Preference::getStationPodcastId());
|
||||
return (int) $stationPodcast->hasEpisodeForFile($fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $episodeId
|
||||
* @return array
|
||||
* @throws PodcastEpisodeNotFoundException
|
||||
*/
|
||||
public static function getPodcastEpisodeById($episodeId)
|
||||
{
|
||||
$episode = PodcastEpisodesQuery::create()->findPk($episodeId);
|
||||
if (!$episode) {
|
||||
throw new PodcastEpisodeNotFoundException();
|
||||
}
|
||||
|
||||
return $episode->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Podcast episodes, with the option to paginate the results.
|
||||
*
|
||||
* @param $podcastId
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @param string $sortColumn
|
||||
* @param string $sortDir "ASC" || "DESC"
|
||||
* @return array
|
||||
* @throws PodcastNotFoundException
|
||||
*/
|
||||
public function getPodcastEpisodes($podcastId,
|
||||
$offset=0,
|
||||
$limit=10,
|
||||
$sortColumn=PodcastEpisodesPeer::PUBLICATION_DATE,
|
||||
$sortDir="ASC")
|
||||
{
|
||||
$podcast = PodcastQuery::create()->findPk($podcastId);
|
||||
if (!$podcast) {
|
||||
throw new PodcastNotFoundException();
|
||||
}
|
||||
|
||||
$sortDir = ($sortDir === "DESC") ? $sortDir = Criteria::DESC : Criteria::ASC;
|
||||
$isStationPodcast = $podcastId == Application_Model_Preference::getStationPodcastId();
|
||||
|
||||
$episodes = PodcastEpisodesQuery::create()
|
||||
->filterByDbPodcastId($podcastId);
|
||||
if ($isStationPodcast && $limit != 0) {
|
||||
$episodes = $episodes->setLimit($limit);
|
||||
}
|
||||
// XXX: We should maybe try to alias this so we don't pass CcFiles as an array key to the frontend.
|
||||
// It would require us to iterate over all the episodes and change the key for the response though...
|
||||
$episodes = $episodes->joinWith('PodcastEpisodes.CcFiles', Criteria::LEFT_JOIN)
|
||||
->setOffset($offset)
|
||||
->orderBy($sortColumn, $sortDir)
|
||||
->find();
|
||||
|
||||
return $isStationPodcast ? $this->_getStationPodcastEpisodeArray($episodes)
|
||||
: $this->_getImportedPodcastEpisodeArray($podcast, $episodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of PodcastEpisodes objects from the Station Podcast,
|
||||
* convert the episode data into array form
|
||||
*
|
||||
* @param array $episodes array of PodcastEpisodes to convert
|
||||
* @return array
|
||||
*/
|
||||
private function _getStationPodcastEpisodeArray($episodes) {
|
||||
$episodesArray = array();
|
||||
foreach ($episodes as $episode) {
|
||||
/** @var PodcastEpisodes $episode */
|
||||
$episodeArr = $episode->toArray(BasePeer::TYPE_FIELDNAME, true, [], true);
|
||||
array_push($episodesArray, $episodeArr);
|
||||
}
|
||||
return $episodesArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an ImportedPodcast object and an array of stored PodcastEpisodes objects,
|
||||
* fetch all episodes from the podcast RSS feed, and serialize them in a readable form
|
||||
*
|
||||
* TODO: there's definitely a better approach than this... we should be trying to create
|
||||
* PodcastEpisdoes objects instead of our own arrays
|
||||
*
|
||||
* @param ImportedPodcast $podcast Podcast object to fetch the episodes for
|
||||
* @param array $episodes array of PodcastEpisodes objects to
|
||||
*
|
||||
* @return array array of episode data
|
||||
*
|
||||
* @throws CcFiles/FileNotFoundException
|
||||
*/
|
||||
public function _getImportedPodcastEpisodeArray($podcast, $episodes) {
|
||||
$rss = Application_Service_PodcastService::getPodcastFeed($podcast->getDbUrl());
|
||||
$episodeIds = array();
|
||||
$episodeFiles = array();
|
||||
foreach ($episodes as $e) {
|
||||
/** @var PodcastEpisodes $e */
|
||||
array_push($episodeIds, $e->getDbEpisodeGuid());
|
||||
$episodeFiles[$e->getDbEpisodeGuid()] = $e->getDbFileId();
|
||||
}
|
||||
|
||||
$episodesArray = array();
|
||||
foreach ($rss->get_items() as $item) {
|
||||
/** @var SimplePie_Item $item */
|
||||
// If the enclosure is empty or has not URL, this isn't a podcast episode (there's no audio data)
|
||||
$enclosure = $item->get_enclosure();
|
||||
$url = $enclosure instanceof SimplePie_Enclosure ? $enclosure->get_link() : $enclosure["link"];
|
||||
if (empty($url)) { continue; }
|
||||
$itemId = $item->get_id();
|
||||
$ingested = in_array($itemId, $episodeIds) ? (empty($episodeFiles[$itemId]) ? -1 : 1) : 0;
|
||||
$file = $ingested > 0 && !empty($episodeFiles[$itemId]) ?
|
||||
CcFiles::getSanitizedFileById($episodeFiles[$itemId]) : array();
|
||||
// If the analyzer hasn't finished with the file, leave it as pending
|
||||
if (!empty($file) && $file["import_status"] == CcFiles::IMPORT_STATUS_PENDING) {
|
||||
$ingested = -1;
|
||||
}
|
||||
|
||||
array_push($episodesArray, array(
|
||||
"podcast_id" => $podcast->getDbId(),
|
||||
"guid" => $itemId,
|
||||
"ingested" => $ingested,
|
||||
"title" => $item->get_title(),
|
||||
// From the RSS spec best practices:
|
||||
// 'An item's author element provides the e-mail address of the person who wrote the item'
|
||||
"author" => $this->_buildAuthorString($item),
|
||||
"description" => htmlspecialchars($item->get_description()),
|
||||
"pub_date" => $item->get_gmdate(),
|
||||
"link" => $item->get_link(),
|
||||
"enclosure" => $item->get_enclosure(),
|
||||
"file" => $file
|
||||
));
|
||||
}
|
||||
|
||||
return $episodesArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a string representation of the author fields of a SimplePie_Item object
|
||||
*
|
||||
* @param SimplePie_Item $item the SimplePie_Item to extract the author data from
|
||||
*
|
||||
* @return string the string representation of the author data
|
||||
*/
|
||||
private function _buildAuthorString(SimplePie_Item $item) {
|
||||
$authorString = $author = $item->get_author();
|
||||
if (!empty($author)) {
|
||||
$authorString = $author->get_email();
|
||||
$authorString = empty($authorString) ? $author->get_name() : $authorString;
|
||||
}
|
||||
|
||||
return $authorString;
|
||||
}
|
||||
|
||||
public function deletePodcastEpisodeById($episodeId)
|
||||
{
|
||||
$episode = PodcastEpisodesQuery::create()->findByDbId($episodeId);
|
||||
|
||||
if ($episode) {
|
||||
$episode->delete();
|
||||
} else {
|
||||
throw new PodcastEpisodeNotFoundException();
|
||||
}
|
||||
}
|
||||
|
||||
private function removePrivateFields(&$data)
|
||||
{
|
||||
foreach (self::$privateFields as $key) {
|
||||
unset($data[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class PodcastFactory
|
||||
{
|
||||
public static function create($feedUrl)
|
||||
{
|
||||
// check if station podcast exists and if not, create one
|
||||
$stationPodcastId = Application_Model_Preference::getStationPodcastId();
|
||||
if (empty($stationPodcastId)) {
|
||||
Application_Service_PodcastService::createStationPodcast();
|
||||
}
|
||||
|
||||
return Application_Service_PodcastService::createFromFeedUrl($feedUrl);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue