diff --git a/airtime_mvc/application/models/airtime/ImportedPodcast.php b/airtime_mvc/application/models/airtime/ImportedPodcast.php index d32a398da..7c81c4ea4 100644 --- a/airtime_mvc/application/models/airtime/ImportedPodcast.php +++ b/airtime_mvc/application/models/airtime/ImportedPodcast.php @@ -15,237 +15,19 @@ */ 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) + /*public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (Application_Service_PodcastService::podcastLimitReached()) { - throw new PodcastLimitReachedException(); - } + $importedPodcastArray = parent::toArray(BasePeer::TYPE_FIELDNAME); + //unset this ID so we only pass back the Podcast ID + unset($importedPodcastArray["id"]); - $rss = Application_Service_PodcastService::getPodcastFeed($data["url"]); - if (!$rss) { - throw new InvalidPodcastException(); - } + $podcastArray = $this->getPodcast()->toArray(BasePeer::TYPE_FIELDNAME); - // 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"]; + $array = array_merge($podcastArray, $importedPodcastArray); - $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(); + //unset podcast_id because we already have that value in $importedPodcastArray + unset($array["podcast_id"]); - $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 Podcast(); - $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()); - } - } + return $array; + }*/ } diff --git a/airtime_mvc/application/models/airtime/ImportedPodcast.php.bak b/airtime_mvc/application/models/airtime/ImportedPodcast.php.bak new file mode 100644 index 000000000..fa4804f38 --- /dev/null +++ b/airtime_mvc/application/models/airtime/ImportedPodcast.php.bak @@ -0,0 +1,251 @@ +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()); + } + } +} diff --git a/airtime_mvc/application/models/airtime/Podcast.php b/airtime_mvc/application/models/airtime/Podcast.php index 6dd83fdcb..88ad42ce3 100644 --- a/airtime_mvc/application/models/airtime/Podcast.php +++ b/airtime_mvc/application/models/airtime/Podcast.php @@ -13,6 +13,24 @@ * * @package propel.generator.airtime */ -abstract class Podcast extends BasePodcast +class Podcast extends BasePodcast { + /*public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + + $podcastArray = parent::toArray(BasePeer::TYPE_FIELDNAME); + $podcastArray["url"] = $this->getDbUrl(); + + //$array = array_merge($podcastArray, $importedPodcastArray); + + //unset podcast_id because we already have that value in $importedPodcastArray + //unset($array["podcast_id"]); + + return $podcastArray; + } + + public function getDbUrl() + { + return $this->getImportedPodcasts()->getFirst()->getDbUrl(); + }*/ } diff --git a/airtime_mvc/application/models/airtime/PodcastEpisodes.php b/airtime_mvc/application/models/airtime/PodcastEpisodes.php index 0eda3469e..36019ff88 100644 --- a/airtime_mvc/application/models/airtime/PodcastEpisodes.php +++ b/airtime_mvc/application/models/airtime/PodcastEpisodes.php @@ -1,8 +1,6 @@ findPk($episodeId); - if (!$episode) { - throw new PodcastEpisodeNotFoundException(); - } - - return $episode->toArray(BasePeer::TYPE_FIELDNAME); - } - - public static function getPodcastEpisodes($podcastId) - { - $podcast = PodcastQuery::create()->findPk($podcastId); - if (!$podcast) { - throw new PodcastNotFoundException(); - } - - $episodes = PodcastEpisodesQuery::create()->findByDbPodcastId($podcastId); - $episodesArray = array(); - foreach ($episodes as $episode) { - array_push($episodesArray, $episode->toArray(BasePeer::TYPE_FIELDNAME)); - } - - return $episodesArray; - } - - public static function create($podcastId, $data) - { - self::removePrivateFields($data); - self::validateEpisodeData($data); - - try { - $episode = new PodcastEpisodes(); - $episode->setDbPodcastId($podcastId); - $episode->fromArray($data, BasePeer::TYPE_FIELDNAME); - $episode->save(); - - return $episode->toArray(BasePeer::TYPE_FIELDNAME); - } catch (Exception $e) { - $episode->delete(); - throw $e; - } - - } - - public static function deleteById($episodeId) - { - $episode = PodcastEpisodesQuery::create()->findByDbId($episodeId); - - if ($episode) { - $episode->delete(); - } else { - throw new PodcastEpisodeNotFoundException(); - } - } - - private static function removePrivateFields(&$data) - { - foreach (self::$privateFields as $key) { - unset($data[$key]); - } - } - - /** - * Trims the episode data to fit the table's column max size - * - * @param $episodeArray - */ - private static function validateEpisodeData(&$episodeArray) - { - $podcastEpisodeTable = PodcastEpisodesPeer::getTableMap(); - - foreach ($episodeArray as $key => &$value) { - try { - // Make sure column exists in table - $columnMaxSize = $podcastEpisodeTable->getColumn($key)->getSize(); - - if (is_null($columnMaxSize)) { - continue; - } - } catch (PropelException $e) { - continue; - } - - if (strlen($value) > $columnMaxSize) { - $value = substr($value, 0, $podcastEpisodeTable->getColumn($key)->getSize()); - } - } - } } diff --git a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php index 09e1e0bec..80a6a2c2c 100644 --- a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php @@ -70,8 +70,6 @@ class CcSubjsTableMap extends TableMap $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'); - $this->addRelation('StationPodcast', 'StationPodcast', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), 'CASCADE', null, 'StationPodcasts'); - $this->addRelation('ImportedPodcast', 'ImportedPodcast', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), 'CASCADE', null, 'ImportedPodcasts'); } // buildRelations() } // CcSubjsTableMap diff --git a/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php b/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php index e89c1aa01..ff39487df 100644 --- a/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php +++ b/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php @@ -36,24 +36,13 @@ class ImportedPodcastTableMap extends TableMap $this->setPhpName('ImportedPodcast'); $this->setClassname('ImportedPodcast'); $this->setPackage('airtime'); - $this->setUseIdGenerator(false); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('imported_podcast_id_seq'); // columns + $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); $this->addColumn('url', 'DbUrl', 'VARCHAR', true, 4096, null); $this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false); - $this->addForeignPrimaryKey('id', 'DbId', 'INTEGER' , 'podcast', 'id', true, null, 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); + $this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null); // validators } // initialize() @@ -62,8 +51,7 @@ class ImportedPodcastTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), 'CASCADE', null); + $this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('podcast_id' => 'id', ), 'CASCADE', null); } // buildRelations() /** @@ -75,12 +63,8 @@ class ImportedPodcastTableMap extends TableMap public function getBehaviors() { return array( - 'concrete_inheritance' => array ( - 'extends' => 'podcast', - 'descendant_column' => 'descendant_class', - 'copy_data_to_parent' => 'true', - 'schema' => '', - 'excluded_parent_behavior' => 'nested_set', + 'delegate' => array ( + 'to' => 'podcast', ), ); } // getBehaviors() diff --git a/airtime_mvc/application/models/airtime/map/PodcastTableMap.php b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php index 640f2204c..9ae7565df 100644 --- a/airtime_mvc/application/models/airtime/map/PodcastTableMap.php +++ b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php @@ -53,7 +53,6 @@ class PodcastTableMap extends TableMap $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); - $this->addColumn('descendant_class', 'DescendantClass', 'VARCHAR', false, 100, null); // validators } // initialize() @@ -63,24 +62,9 @@ class PodcastTableMap extends TableMap 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'); - $this->addRelation('StationPodcast', 'StationPodcast', RelationMap::ONE_TO_ONE, array('id' => 'id', ), 'CASCADE', null); - $this->addRelation('ImportedPodcast', 'ImportedPodcast', RelationMap::ONE_TO_ONE, array('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( - 'concrete_inheritance_parent' => array ( - 'descendant_column' => 'descendant_class', -), - ); - } // getBehaviors() - } // PodcastTableMap diff --git a/airtime_mvc/application/models/airtime/map/StationPodcastTableMap.php b/airtime_mvc/application/models/airtime/map/StationPodcastTableMap.php index 45c73f887..b36685ba4 100644 --- a/airtime_mvc/application/models/airtime/map/StationPodcastTableMap.php +++ b/airtime_mvc/application/models/airtime/map/StationPodcastTableMap.php @@ -36,22 +36,11 @@ class StationPodcastTableMap extends TableMap $this->setPhpName('StationPodcast'); $this->setClassname('StationPodcast'); $this->setPackage('airtime'); - $this->setUseIdGenerator(false); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('station_podcast_id_seq'); // columns - $this->addForeignPrimaryKey('id', 'DbId', 'INTEGER' , 'podcast', 'id', true, null, 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); + $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); + $this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null); // validators } // initialize() @@ -60,8 +49,7 @@ class StationPodcastTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), 'CASCADE', null); + $this->addRelation('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('podcast_id' => 'id', ), 'CASCADE', null); } // buildRelations() /** @@ -73,12 +61,8 @@ class StationPodcastTableMap extends TableMap public function getBehaviors() { return array( - 'concrete_inheritance' => array ( - 'extends' => 'podcast', - 'descendant_column' => 'descendant_class', - 'copy_data_to_parent' => 'true', - 'schema' => '', - 'excluded_parent_behavior' => 'nested_set', + 'delegate' => array ( + 'to' => 'podcast', ), ); } // getBehaviors() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php index 02fb9ae8d..1368aafa5 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php @@ -173,18 +173,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent protected $collPodcasts; protected $collPodcastsPartial; - /** - * @var PropelObjectCollection|StationPodcast[] Collection to store aggregation of StationPodcast objects. - */ - protected $collStationPodcasts; - protected $collStationPodcastsPartial; - - /** - * @var PropelObjectCollection|ImportedPodcast[] Collection to store aggregation of ImportedPodcast objects. - */ - protected $collImportedPodcasts; - protected $collImportedPodcastsPartial; - /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -265,18 +253,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent */ protected $podcastsScheduledForDeletion = null; - /** - * An array of objects scheduled for deletion. - * @var PropelObjectCollection - */ - protected $stationPodcastsScheduledForDeletion = null; - - /** - * An array of objects scheduled for deletion. - * @var PropelObjectCollection - */ - protected $importedPodcastsScheduledForDeletion = null; - /** * Applies default values to this object. * This method should be called from the object's constructor (or @@ -931,10 +907,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->collPodcasts = null; - $this->collStationPodcasts = null; - - $this->collImportedPodcasts = null; - } // if (deep) } @@ -1231,40 +1203,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } - if ($this->stationPodcastsScheduledForDeletion !== null) { - if (!$this->stationPodcastsScheduledForDeletion->isEmpty()) { - StationPodcastQuery::create() - ->filterByPrimaryKeys($this->stationPodcastsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->stationPodcastsScheduledForDeletion = null; - } - } - - if ($this->collStationPodcasts !== null) { - foreach ($this->collStationPodcasts as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->importedPodcastsScheduledForDeletion !== null) { - if (!$this->importedPodcastsScheduledForDeletion->isEmpty()) { - ImportedPodcastQuery::create() - ->filterByPrimaryKeys($this->importedPodcastsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->importedPodcastsScheduledForDeletion = null; - } - } - - if ($this->collImportedPodcasts !== null) { - foreach ($this->collImportedPodcasts as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - $this->alreadyInSave = false; } @@ -1562,22 +1500,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } - if ($this->collStationPodcasts !== null) { - foreach ($this->collStationPodcasts as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collImportedPodcasts !== null) { - foreach ($this->collImportedPodcasts as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - $this->alreadyInValidation = false; } @@ -1731,12 +1653,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if (null !== $this->collPodcasts) { $result['Podcasts'] = $this->collPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collStationPodcasts) { - $result['StationPodcasts'] = $this->collStationPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - if (null !== $this->collImportedPodcasts) { - $result['ImportedPodcasts'] = $this->collImportedPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } } return $result; @@ -2014,18 +1930,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } - foreach ($this->getStationPodcasts() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addStationPodcast($relObj->copy($deepCopy)); - } - } - - foreach ($this->getImportedPodcasts() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addImportedPodcast($relObj->copy($deepCopy)); - } - } - //unflag object copy $this->startCopy = false; } // if ($deepCopy) @@ -2117,12 +2021,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if ('Podcast' == $relationName) { $this->initPodcasts(); } - if ('StationPodcast' == $relationName) { - $this->initStationPodcasts(); - } - if ('ImportedPodcast' == $relationName) { - $this->initImportedPodcasts(); - } } /** @@ -4450,506 +4348,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent return $this; } - /** - * Clears out the collStationPodcasts collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return CcSubjs The current object (for fluent API support) - * @see addStationPodcasts() - */ - public function clearStationPodcasts() - { - $this->collStationPodcasts = null; // important to set this to null since that means it is uninitialized - $this->collStationPodcastsPartial = null; - - return $this; - } - - /** - * reset is the collStationPodcasts collection loaded partially - * - * @return void - */ - public function resetPartialStationPodcasts($v = true) - { - $this->collStationPodcastsPartial = $v; - } - - /** - * Initializes the collStationPodcasts collection. - * - * By default this just sets the collStationPodcasts collection to an empty array (like clearcollStationPodcasts()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initStationPodcasts($overrideExisting = true) - { - if (null !== $this->collStationPodcasts && !$overrideExisting) { - return; - } - $this->collStationPodcasts = new PropelObjectCollection(); - $this->collStationPodcasts->setModel('StationPodcast'); - } - - /** - * Gets an array of StationPodcast objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this 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|StationPodcast[] List of StationPodcast objects - * @throws PropelException - */ - public function getStationPodcasts($criteria = null, PropelPDO $con = null) - { - $partial = $this->collStationPodcastsPartial && !$this->isNew(); - if (null === $this->collStationPodcasts || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collStationPodcasts) { - // return empty collection - $this->initStationPodcasts(); - } else { - $collStationPodcasts = StationPodcastQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collStationPodcastsPartial && count($collStationPodcasts)) { - $this->initStationPodcasts(false); - - foreach ($collStationPodcasts as $obj) { - if (false == $this->collStationPodcasts->contains($obj)) { - $this->collStationPodcasts->append($obj); - } - } - - $this->collStationPodcastsPartial = true; - } - - $collStationPodcasts->getInternalIterator()->rewind(); - - return $collStationPodcasts; - } - - if ($partial && $this->collStationPodcasts) { - foreach ($this->collStationPodcasts as $obj) { - if ($obj->isNew()) { - $collStationPodcasts[] = $obj; - } - } - } - - $this->collStationPodcasts = $collStationPodcasts; - $this->collStationPodcastsPartial = false; - } - } - - return $this->collStationPodcasts; - } - - /** - * Sets a collection of StationPodcast objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $stationPodcasts A Propel collection. - * @param PropelPDO $con Optional connection object - * @return CcSubjs The current object (for fluent API support) - */ - public function setStationPodcasts(PropelCollection $stationPodcasts, PropelPDO $con = null) - { - $stationPodcastsToDelete = $this->getStationPodcasts(new Criteria(), $con)->diff($stationPodcasts); - - - $this->stationPodcastsScheduledForDeletion = $stationPodcastsToDelete; - - foreach ($stationPodcastsToDelete as $stationPodcastRemoved) { - $stationPodcastRemoved->setCcSubjs(null); - } - - $this->collStationPodcasts = null; - foreach ($stationPodcasts as $stationPodcast) { - $this->addStationPodcast($stationPodcast); - } - - $this->collStationPodcasts = $stationPodcasts; - $this->collStationPodcastsPartial = false; - - return $this; - } - - /** - * Returns the number of related StationPodcast objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related StationPodcast objects. - * @throws PropelException - */ - public function countStationPodcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collStationPodcastsPartial && !$this->isNew(); - if (null === $this->collStationPodcasts || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collStationPodcasts) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getStationPodcasts()); - } - $query = StationPodcastQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByCcSubjs($this) - ->count($con); - } - - return count($this->collStationPodcasts); - } - - /** - * Method called to associate a StationPodcast object to this object - * through the StationPodcast foreign key attribute. - * - * @param StationPodcast $l StationPodcast - * @return CcSubjs The current object (for fluent API support) - */ - public function addStationPodcast(StationPodcast $l) - { - if ($this->collStationPodcasts === null) { - $this->initStationPodcasts(); - $this->collStationPodcastsPartial = true; - } - - if (!in_array($l, $this->collStationPodcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddStationPodcast($l); - - if ($this->stationPodcastsScheduledForDeletion and $this->stationPodcastsScheduledForDeletion->contains($l)) { - $this->stationPodcastsScheduledForDeletion->remove($this->stationPodcastsScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param StationPodcast $stationPodcast The stationPodcast object to add. - */ - protected function doAddStationPodcast($stationPodcast) - { - $this->collStationPodcasts[]= $stationPodcast; - $stationPodcast->setCcSubjs($this); - } - - /** - * @param StationPodcast $stationPodcast The stationPodcast object to remove. - * @return CcSubjs The current object (for fluent API support) - */ - public function removeStationPodcast($stationPodcast) - { - if ($this->getStationPodcasts()->contains($stationPodcast)) { - $this->collStationPodcasts->remove($this->collStationPodcasts->search($stationPodcast)); - if (null === $this->stationPodcastsScheduledForDeletion) { - $this->stationPodcastsScheduledForDeletion = clone $this->collStationPodcasts; - $this->stationPodcastsScheduledForDeletion->clear(); - } - $this->stationPodcastsScheduledForDeletion[]= $stationPodcast; - $stationPodcast->setCcSubjs(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this CcSubjs is new, it will return - * an empty collection; or if this CcSubjs has previously - * been saved, it will retrieve related StationPodcasts from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in CcSubjs. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return PropelObjectCollection|StationPodcast[] List of StationPodcast objects - */ - public function getStationPodcastsJoinPodcast($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $query = StationPodcastQuery::create(null, $criteria); - $query->joinWith('Podcast', $join_behavior); - - return $this->getStationPodcasts($query, $con); - } - - /** - * Clears out the collImportedPodcasts collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return CcSubjs The current object (for fluent API support) - * @see addImportedPodcasts() - */ - public function clearImportedPodcasts() - { - $this->collImportedPodcasts = null; // important to set this to null since that means it is uninitialized - $this->collImportedPodcastsPartial = null; - - return $this; - } - - /** - * reset is the collImportedPodcasts collection loaded partially - * - * @return void - */ - public function resetPartialImportedPodcasts($v = true) - { - $this->collImportedPodcastsPartial = $v; - } - - /** - * Initializes the collImportedPodcasts collection. - * - * By default this just sets the collImportedPodcasts collection to an empty array (like clearcollImportedPodcasts()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initImportedPodcasts($overrideExisting = true) - { - if (null !== $this->collImportedPodcasts && !$overrideExisting) { - return; - } - $this->collImportedPodcasts = new PropelObjectCollection(); - $this->collImportedPodcasts->setModel('ImportedPodcast'); - } - - /** - * Gets an array of ImportedPodcast objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this 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|ImportedPodcast[] List of ImportedPodcast objects - * @throws PropelException - */ - public function getImportedPodcasts($criteria = null, PropelPDO $con = null) - { - $partial = $this->collImportedPodcastsPartial && !$this->isNew(); - if (null === $this->collImportedPodcasts || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportedPodcasts) { - // return empty collection - $this->initImportedPodcasts(); - } else { - $collImportedPodcasts = ImportedPodcastQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - if (false !== $this->collImportedPodcastsPartial && count($collImportedPodcasts)) { - $this->initImportedPodcasts(false); - - foreach ($collImportedPodcasts as $obj) { - if (false == $this->collImportedPodcasts->contains($obj)) { - $this->collImportedPodcasts->append($obj); - } - } - - $this->collImportedPodcastsPartial = true; - } - - $collImportedPodcasts->getInternalIterator()->rewind(); - - return $collImportedPodcasts; - } - - if ($partial && $this->collImportedPodcasts) { - foreach ($this->collImportedPodcasts as $obj) { - if ($obj->isNew()) { - $collImportedPodcasts[] = $obj; - } - } - } - - $this->collImportedPodcasts = $collImportedPodcasts; - $this->collImportedPodcastsPartial = false; - } - } - - return $this->collImportedPodcasts; - } - - /** - * Sets a collection of ImportedPodcast objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param PropelCollection $importedPodcasts A Propel collection. - * @param PropelPDO $con Optional connection object - * @return CcSubjs The current object (for fluent API support) - */ - public function setImportedPodcasts(PropelCollection $importedPodcasts, PropelPDO $con = null) - { - $importedPodcastsToDelete = $this->getImportedPodcasts(new Criteria(), $con)->diff($importedPodcasts); - - - $this->importedPodcastsScheduledForDeletion = $importedPodcastsToDelete; - - foreach ($importedPodcastsToDelete as $importedPodcastRemoved) { - $importedPodcastRemoved->setCcSubjs(null); - } - - $this->collImportedPodcasts = null; - foreach ($importedPodcasts as $importedPodcast) { - $this->addImportedPodcast($importedPodcast); - } - - $this->collImportedPodcasts = $importedPodcasts; - $this->collImportedPodcastsPartial = false; - - return $this; - } - - /** - * Returns the number of related ImportedPodcast objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related ImportedPodcast objects. - * @throws PropelException - */ - public function countImportedPodcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - $partial = $this->collImportedPodcastsPartial && !$this->isNew(); - if (null === $this->collImportedPodcasts || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportedPodcasts) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getImportedPodcasts()); - } - $query = ImportedPodcastQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByCcSubjs($this) - ->count($con); - } - - return count($this->collImportedPodcasts); - } - - /** - * Method called to associate a ImportedPodcast object to this object - * through the ImportedPodcast foreign key attribute. - * - * @param ImportedPodcast $l ImportedPodcast - * @return CcSubjs The current object (for fluent API support) - */ - public function addImportedPodcast(ImportedPodcast $l) - { - if ($this->collImportedPodcasts === null) { - $this->initImportedPodcasts(); - $this->collImportedPodcastsPartial = true; - } - - if (!in_array($l, $this->collImportedPodcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddImportedPodcast($l); - - if ($this->importedPodcastsScheduledForDeletion and $this->importedPodcastsScheduledForDeletion->contains($l)) { - $this->importedPodcastsScheduledForDeletion->remove($this->importedPodcastsScheduledForDeletion->search($l)); - } - } - - return $this; - } - - /** - * @param ImportedPodcast $importedPodcast The importedPodcast object to add. - */ - protected function doAddImportedPodcast($importedPodcast) - { - $this->collImportedPodcasts[]= $importedPodcast; - $importedPodcast->setCcSubjs($this); - } - - /** - * @param ImportedPodcast $importedPodcast The importedPodcast object to remove. - * @return CcSubjs The current object (for fluent API support) - */ - public function removeImportedPodcast($importedPodcast) - { - if ($this->getImportedPodcasts()->contains($importedPodcast)) { - $this->collImportedPodcasts->remove($this->collImportedPodcasts->search($importedPodcast)); - if (null === $this->importedPodcastsScheduledForDeletion) { - $this->importedPodcastsScheduledForDeletion = clone $this->collImportedPodcasts; - $this->importedPodcastsScheduledForDeletion->clear(); - } - $this->importedPodcastsScheduledForDeletion[]= $importedPodcast; - $importedPodcast->setCcSubjs(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this CcSubjs is new, it will return - * an empty collection; or if this CcSubjs has previously - * been saved, it will retrieve related ImportedPodcasts from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in CcSubjs. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return PropelObjectCollection|ImportedPodcast[] List of ImportedPodcast objects - */ - public function getImportedPodcastsJoinPodcast($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $query = ImportedPodcastQuery::create(null, $criteria); - $query->joinWith('Podcast', $join_behavior); - - return $this->getImportedPodcasts($query, $con); - } - /** * Clears the current object and sets all attributes to their default values */ @@ -5041,16 +4439,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $o->clearAllReferences($deep); } } - if ($this->collStationPodcasts) { - foreach ($this->collStationPodcasts as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collImportedPodcasts) { - foreach ($this->collImportedPodcasts as $o) { - $o->clearAllReferences($deep); - } - } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) @@ -5095,14 +4483,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->collPodcasts->clearIterator(); } $this->collPodcasts = null; - if ($this->collStationPodcasts instanceof PropelCollection) { - $this->collStationPodcasts->clearIterator(); - } - $this->collStationPodcasts = null; - if ($this->collImportedPodcasts instanceof PropelCollection) { - $this->collImportedPodcasts->clearIterator(); - } - $this->collImportedPodcasts = null; } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php index 03823587d..2f3d3b502 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php @@ -439,12 +439,6 @@ abstract class BaseCcSubjsPeer // Invalidate objects in PodcastPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. PodcastPeer::clearInstancePool(); - // Invalidate objects in StationPodcastPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - StationPodcastPeer::clearInstancePool(); - // Invalidate objects in ImportedPodcastPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - ImportedPodcastPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php index af9a68404..11fab88b1 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php @@ -78,14 +78,6 @@ * @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 CcSubjsQuery leftJoinStationPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the StationPodcast relation - * @method CcSubjsQuery rightJoinStationPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the StationPodcast relation - * @method CcSubjsQuery innerJoinStationPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the StationPodcast relation - * - * @method CcSubjsQuery leftJoinImportedPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportedPodcast relation - * @method CcSubjsQuery rightJoinImportedPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportedPodcast relation - * @method CcSubjsQuery innerJoinImportedPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportedPodcast 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 * @@ -1482,154 +1474,6 @@ abstract class BaseCcSubjsQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'Podcast', 'PodcastQuery'); } - /** - * Filter the query by a related StationPodcast object - * - * @param StationPodcast|PropelObjectCollection $stationPodcast the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByStationPodcast($stationPodcast, $comparison = null) - { - if ($stationPodcast instanceof StationPodcast) { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $stationPodcast->getDbOwner(), $comparison); - } elseif ($stationPodcast instanceof PropelObjectCollection) { - return $this - ->useStationPodcastQuery() - ->filterByPrimaryKeys($stationPodcast->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByStationPodcast() only accepts arguments of type StationPodcast or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the StationPodcast relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinStationPodcast($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('StationPodcast'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'StationPodcast'); - } - - return $this; - } - - /** - * Use the StationPodcast relation StationPodcast object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return StationPodcastQuery A secondary query class using the current class as primary query - */ - public function useStationPodcastQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinStationPodcast($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'StationPodcast', 'StationPodcastQuery'); - } - - /** - * Filter the query by a related ImportedPodcast object - * - * @param ImportedPodcast|PropelObjectCollection $importedPodcast the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByImportedPodcast($importedPodcast, $comparison = null) - { - if ($importedPodcast instanceof ImportedPodcast) { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $importedPodcast->getDbOwner(), $comparison); - } elseif ($importedPodcast instanceof PropelObjectCollection) { - return $this - ->useImportedPodcastQuery() - ->filterByPrimaryKeys($importedPodcast->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByImportedPodcast() only accepts arguments of type ImportedPodcast or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the ImportedPodcast relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinImportedPodcast($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportedPodcast'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'ImportedPodcast'); - } - - return $this; - } - - /** - * Use the ImportedPodcast relation ImportedPodcast object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ImportedPodcastQuery A secondary query class using the current class as primary query - */ - public function useImportedPodcastQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinImportedPodcast($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportedPodcast', 'ImportedPodcastQuery'); - } - /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php index 7eec9a1a1..44342dd99 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php @@ -8,7 +8,7 @@ * * @package propel.generator.airtime.om */ -abstract class BaseImportedPodcast extends Podcast implements Persistent +abstract class BaseImportedPodcast extends BaseObject implements Persistent { /** * Peer class name @@ -29,6 +29,12 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent */ protected $startCopy = false; + /** + * The value for the id field. + * @var int + */ + protected $id; + /** * The value for the url field. * @var string @@ -43,99 +49,16 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent protected $auto_ingest; /** - * The value for the id field. + * The value for the podcast_id field. * @var int */ - protected $id; - - /** - * The value for the title field. - * @var string - */ - protected $title; - - /** - * The value for the creator field. - * @var string - */ - protected $creator; - - /** - * The value for the description field. - * @var string - */ - protected $description; - - /** - * The value for the language field. - * @var string - */ - protected $language; - - /** - * The value for the copyright field. - * @var string - */ - protected $copyright; - - /** - * The value for the link field. - * @var string - */ - protected $link; - - /** - * The value for the itunes_author field. - * @var string - */ - protected $itunes_author; - - /** - * The value for the itunes_keywords field. - * @var string - */ - protected $itunes_keywords; - - /** - * The value for the itunes_summary field. - * @var string - */ - protected $itunes_summary; - - /** - * The value for the itunes_subtitle field. - * @var string - */ - protected $itunes_subtitle; - - /** - * The value for the itunes_category field. - * @var string - */ - protected $itunes_category; - - /** - * The value for the itunes_explicit field. - * @var string - */ - protected $itunes_explicit; - - /** - * The value for the owner field. - * @var int - */ - protected $owner; + protected $podcast_id; /** * @var Podcast */ protected $aPodcast; - /** - * @var CcSubjs - */ - protected $aCcSubjs; - /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -177,6 +100,17 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent $this->applyDefaultValues(); } + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + + return $this->id; + } + /** * Get the [url] column value. * @@ -200,158 +134,36 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent } /** - * Get the [id] column value. + * Get the [podcast_id] column value. * * @return int */ - public function getDbId() + public function getDbPodcastId() { - return $this->id; + return $this->podcast_id; } /** - * Get the [title] column value. + * Set the value of [id] column. * - * @return string + * @param int $v new value + * @return ImportedPodcast The current object (for fluent API support) */ - public function getDbTitle() + public function setDbId($v) { + if ($v !== null && is_numeric($v)) { + $v = (int) $v; + } - return $this->title; - } + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ImportedPodcastPeer::ID; + } - /** - * Get the [creator] column value. - * - * @return string - */ - public function getDbCreator() - { - return $this->creator; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDbDescription() - { - - return $this->description; - } - - /** - * Get the [language] column value. - * - * @return string - */ - public function getDbLanguage() - { - - return $this->language; - } - - /** - * Get the [copyright] column value. - * - * @return string - */ - public function getDbCopyright() - { - - return $this->copyright; - } - - /** - * Get the [link] column value. - * - * @return string - */ - public function getDbLink() - { - - return $this->link; - } - - /** - * Get the [itunes_author] column value. - * - * @return string - */ - public function getDbItunesAuthor() - { - - return $this->itunes_author; - } - - /** - * Get the [itunes_keywords] column value. - * - * @return string - */ - public function getDbItunesKeywords() - { - - return $this->itunes_keywords; - } - - /** - * Get the [itunes_summary] column value. - * - * @return string - */ - public function getDbItunesSummary() - { - - return $this->itunes_summary; - } - - /** - * Get the [itunes_subtitle] column value. - * - * @return string - */ - public function getDbItunesSubtitle() - { - - return $this->itunes_subtitle; - } - - /** - * Get the [itunes_category] column value. - * - * @return string - */ - public function getDbItunesCategory() - { - - return $this->itunes_category; - } - - /** - * Get the [itunes_explicit] column value. - * - * @return string - */ - public function getDbItunesExplicit() - { - - return $this->itunes_explicit; - } - - /** - * Get the [owner] column value. - * - * @return int - */ - public function getDbOwner() - { - - return $this->owner; - } + return $this; + } // setDbId() /** * Set the value of [url] column. @@ -404,20 +216,20 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent } // setDbAutoIngest() /** - * Set the value of [id] column. + * Set the value of [podcast_id] column. * * @param int $v new value * @return ImportedPodcast The current object (for fluent API support) */ - public function setDbId($v) + public function setDbPodcastId($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::ID; + if ($this->podcast_id !== $v) { + $this->podcast_id = $v; + $this->modifiedColumns[] = ImportedPodcastPeer::PODCAST_ID; } if ($this->aPodcast !== null && $this->aPodcast->getDbId() !== $v) { @@ -426,284 +238,7 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent return $this; - } // setDbId() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbTitle($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::TITLE; - } - - - return $this; - } // setDbTitle() - - /** - * Set the value of [creator] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbCreator($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->creator !== $v) { - $this->creator = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::CREATOR; - } - - - return $this; - } // setDbCreator() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return ImportedPodcast 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[] = ImportedPodcastPeer::DESCRIPTION; - } - - - return $this; - } // setDbDescription() - - /** - * Set the value of [language] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbLanguage($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->language !== $v) { - $this->language = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::LANGUAGE; - } - - - return $this; - } // setDbLanguage() - - /** - * Set the value of [copyright] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbCopyright($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->copyright !== $v) { - $this->copyright = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::COPYRIGHT; - } - - - return $this; - } // setDbCopyright() - - /** - * Set the value of [link] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbLink($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->link !== $v) { - $this->link = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::LINK; - } - - - return $this; - } // setDbLink() - - /** - * Set the value of [itunes_author] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbItunesAuthor($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_author !== $v) { - $this->itunes_author = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::ITUNES_AUTHOR; - } - - - return $this; - } // setDbItunesAuthor() - - /** - * Set the value of [itunes_keywords] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbItunesKeywords($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_keywords !== $v) { - $this->itunes_keywords = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::ITUNES_KEYWORDS; - } - - - return $this; - } // setDbItunesKeywords() - - /** - * Set the value of [itunes_summary] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbItunesSummary($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_summary !== $v) { - $this->itunes_summary = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::ITUNES_SUMMARY; - } - - - return $this; - } // setDbItunesSummary() - - /** - * Set the value of [itunes_subtitle] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbItunesSubtitle($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_subtitle !== $v) { - $this->itunes_subtitle = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::ITUNES_SUBTITLE; - } - - - return $this; - } // setDbItunesSubtitle() - - /** - * Set the value of [itunes_category] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbItunesCategory($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_category !== $v) { - $this->itunes_category = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::ITUNES_CATEGORY; - } - - - return $this; - } // setDbItunesCategory() - - /** - * Set the value of [itunes_explicit] column. - * - * @param string $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbItunesExplicit($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_explicit !== $v) { - $this->itunes_explicit = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::ITUNES_EXPLICIT; - } - - - return $this; - } // setDbItunesExplicit() - - /** - * Set the value of [owner] column. - * - * @param int $v new value - * @return ImportedPodcast The current object (for fluent API support) - */ - public function setDbOwner($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->owner !== $v) { - $this->owner = $v; - $this->modifiedColumns[] = ImportedPodcastPeer::OWNER; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { - $this->aCcSubjs = null; - } - - - return $this; - } // setDbOwner() + } // setDbPodcastId() /** * Indicates whether the columns in this object are only set to default values. @@ -741,22 +276,10 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent { try { - $this->url = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; - $this->auto_ingest = ($row[$startcol + 1] !== null) ? (boolean) $row[$startcol + 1] : null; - $this->id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; - $this->title = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->creator = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->language = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->copyright = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->link = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->itunes_author = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->itunes_keywords = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->itunes_summary = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; - $this->itunes_subtitle = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; - $this->itunes_category = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; - $this->itunes_explicit = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null; - $this->owner = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null; + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->url = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->auto_ingest = ($row[$startcol + 2] !== null) ? (boolean) $row[$startcol + 2] : null; + $this->podcast_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; $this->resetModified(); $this->setNew(false); @@ -766,7 +289,7 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 16; // 16 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 4; // 4 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating ImportedPodcast object", $e); @@ -789,12 +312,9 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent public function ensureConsistency() { - if ($this->aPodcast !== null && $this->id !== $this->aPodcast->getDbId()) { + if ($this->aPodcast !== null && $this->podcast_id !== $this->aPodcast->getDbId()) { $this->aPodcast = null; } - if ($this->aCcSubjs !== null && $this->owner !== $this->aCcSubjs->getDbId()) { - $this->aCcSubjs = null; - } } // ensureConsistency /** @@ -835,7 +355,6 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent if ($deep) { // also de-associate any related objects? $this->aPodcast = null; - $this->aCcSubjs = null; } // if (deep) } @@ -867,9 +386,6 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); - // concrete_inheritance behavior - $this->getParentOrCreate($con)->delete($con); - $con->commit(); $this->setDeleted(true); } else { @@ -909,11 +425,6 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent $isInsert = $this->isNew(); try { $ret = $this->preSave($con); - // concrete_inheritance behavior - $parent = $this->getSyncParent($con); - $parent->save($con); - $this->setPrimaryKey($parent->getPrimaryKey()); - if ($isInsert) { $ret = $ret && $this->preInsert($con); } else { @@ -969,13 +480,6 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent $this->setPodcast($this->aPodcast); } - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { @@ -1007,55 +511,33 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent $modifiedColumns = array(); $index = 0; + $this->modifiedColumns[] = ImportedPodcastPeer::ID; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ImportedPodcastPeer::ID . ')'); + } + if (null === $this->id) { + try { + $stmt = $con->query("SELECT nextval('imported_podcast_id_seq')"); + $row = $stmt->fetch(PDO::FETCH_NUM); + $this->id = $row[0]; + } catch (Exception $e) { + throw new PropelException('Unable to get sequence id.', $e); + } + } + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(ImportedPodcastPeer::ID)) { + $modifiedColumns[':p' . $index++] = '"id"'; + } if ($this->isColumnModified(ImportedPodcastPeer::URL)) { $modifiedColumns[':p' . $index++] = '"url"'; } if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) { $modifiedColumns[':p' . $index++] = '"auto_ingest"'; } - if ($this->isColumnModified(ImportedPodcastPeer::ID)) { - $modifiedColumns[':p' . $index++] = '"id"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::TITLE)) { - $modifiedColumns[':p' . $index++] = '"title"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::CREATOR)) { - $modifiedColumns[':p' . $index++] = '"creator"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '"description"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::LANGUAGE)) { - $modifiedColumns[':p' . $index++] = '"language"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::COPYRIGHT)) { - $modifiedColumns[':p' . $index++] = '"copyright"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::LINK)) { - $modifiedColumns[':p' . $index++] = '"link"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_AUTHOR)) { - $modifiedColumns[':p' . $index++] = '"itunes_author"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_KEYWORDS)) { - $modifiedColumns[':p' . $index++] = '"itunes_keywords"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_SUMMARY)) { - $modifiedColumns[':p' . $index++] = '"itunes_summary"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_SUBTITLE)) { - $modifiedColumns[':p' . $index++] = '"itunes_subtitle"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_CATEGORY)) { - $modifiedColumns[':p' . $index++] = '"itunes_category"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_EXPLICIT)) { - $modifiedColumns[':p' . $index++] = '"itunes_explicit"'; - } - if ($this->isColumnModified(ImportedPodcastPeer::OWNER)) { - $modifiedColumns[':p' . $index++] = '"owner"'; + if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) { + $modifiedColumns[':p' . $index++] = '"podcast_id"'; } $sql = sprintf( @@ -1068,53 +550,17 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { + case '"id"': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; case '"url"': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; case '"auto_ingest"': $stmt->bindValue($identifier, $this->auto_ingest, PDO::PARAM_BOOL); break; - case '"id"': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case '"title"': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '"creator"': - $stmt->bindValue($identifier, $this->creator, PDO::PARAM_STR); - break; - case '"description"': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '"language"': - $stmt->bindValue($identifier, $this->language, PDO::PARAM_STR); - break; - case '"copyright"': - $stmt->bindValue($identifier, $this->copyright, PDO::PARAM_STR); - break; - case '"link"': - $stmt->bindValue($identifier, $this->link, PDO::PARAM_STR); - break; - case '"itunes_author"': - $stmt->bindValue($identifier, $this->itunes_author, PDO::PARAM_STR); - break; - case '"itunes_keywords"': - $stmt->bindValue($identifier, $this->itunes_keywords, PDO::PARAM_STR); - break; - case '"itunes_summary"': - $stmt->bindValue($identifier, $this->itunes_summary, PDO::PARAM_STR); - break; - case '"itunes_subtitle"': - $stmt->bindValue($identifier, $this->itunes_subtitle, PDO::PARAM_STR); - break; - case '"itunes_category"': - $stmt->bindValue($identifier, $this->itunes_category, PDO::PARAM_STR); - break; - case '"itunes_explicit"': - $stmt->bindValue($identifier, $this->itunes_explicit, PDO::PARAM_STR); - break; - case '"owner"': - $stmt->bindValue($identifier, $this->owner, PDO::PARAM_INT); + case '"podcast_id"': + $stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT); break; } } @@ -1214,12 +660,6 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent } } - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - if (($retval = ImportedPodcastPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); @@ -1262,52 +702,16 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent { switch ($pos) { case 0: - return $this->getDbUrl(); - break; - case 1: - return $this->getDbAutoIngest(); - break; - case 2: return $this->getDbId(); break; + case 1: + return $this->getDbUrl(); + break; + case 2: + return $this->getDbAutoIngest(); + break; case 3: - return $this->getDbTitle(); - break; - case 4: - return $this->getDbCreator(); - break; - case 5: - return $this->getDbDescription(); - break; - case 6: - return $this->getDbLanguage(); - break; - case 7: - return $this->getDbCopyright(); - break; - case 8: - return $this->getDbLink(); - break; - case 9: - return $this->getDbItunesAuthor(); - break; - case 10: - return $this->getDbItunesKeywords(); - break; - case 11: - return $this->getDbItunesSummary(); - break; - case 12: - return $this->getDbItunesSubtitle(); - break; - case 13: - return $this->getDbItunesCategory(); - break; - case 14: - return $this->getDbItunesExplicit(); - break; - case 15: - return $this->getDbOwner(); + return $this->getDbPodcastId(); break; default: return null; @@ -1338,22 +742,10 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent $alreadyDumpedObjects['ImportedPodcast'][$this->getPrimaryKey()] = true; $keys = ImportedPodcastPeer::getFieldNames($keyType); $result = array( - $keys[0] => $this->getDbUrl(), - $keys[1] => $this->getDbAutoIngest(), - $keys[2] => $this->getDbId(), - $keys[3] => $this->getDbTitle(), - $keys[4] => $this->getDbCreator(), - $keys[5] => $this->getDbDescription(), - $keys[6] => $this->getDbLanguage(), - $keys[7] => $this->getDbCopyright(), - $keys[8] => $this->getDbLink(), - $keys[9] => $this->getDbItunesAuthor(), - $keys[10] => $this->getDbItunesKeywords(), - $keys[11] => $this->getDbItunesSummary(), - $keys[12] => $this->getDbItunesSubtitle(), - $keys[13] => $this->getDbItunesCategory(), - $keys[14] => $this->getDbItunesExplicit(), - $keys[15] => $this->getDbOwner(), + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbUrl(), + $keys[2] => $this->getDbAutoIngest(), + $keys[3] => $this->getDbPodcastId(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1364,9 +756,6 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent if (null !== $this->aPodcast) { $result['Podcast'] = $this->aPodcast->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } } return $result; @@ -1402,52 +791,16 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent { switch ($pos) { case 0: - $this->setDbUrl($value); - break; - case 1: - $this->setDbAutoIngest($value); - break; - case 2: $this->setDbId($value); break; + case 1: + $this->setDbUrl($value); + break; + case 2: + $this->setDbAutoIngest($value); + break; case 3: - $this->setDbTitle($value); - break; - case 4: - $this->setDbCreator($value); - break; - case 5: - $this->setDbDescription($value); - break; - case 6: - $this->setDbLanguage($value); - break; - case 7: - $this->setDbCopyright($value); - break; - case 8: - $this->setDbLink($value); - break; - case 9: - $this->setDbItunesAuthor($value); - break; - case 10: - $this->setDbItunesKeywords($value); - break; - case 11: - $this->setDbItunesSummary($value); - break; - case 12: - $this->setDbItunesSubtitle($value); - break; - case 13: - $this->setDbItunesCategory($value); - break; - case 14: - $this->setDbItunesExplicit($value); - break; - case 15: - $this->setDbOwner($value); + $this->setDbPodcastId($value); break; } // switch() } @@ -1473,22 +826,10 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent { $keys = ImportedPodcastPeer::getFieldNames($keyType); - if (array_key_exists($keys[0], $arr)) $this->setDbUrl($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setDbAutoIngest($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbCreator($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbDescription($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDbLanguage($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setDbCopyright($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setDbLink($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setDbItunesAuthor($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setDbItunesKeywords($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setDbItunesSummary($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setDbItunesSubtitle($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setDbItunesCategory($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setDbItunesExplicit($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setDbOwner($arr[$keys[15]]); + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbUrl($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbAutoIngest($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbPodcastId($arr[$keys[3]]); } /** @@ -1500,22 +841,10 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent { $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); + if ($this->isColumnModified(ImportedPodcastPeer::ID)) $criteria->add(ImportedPodcastPeer::ID, $this->id); if ($this->isColumnModified(ImportedPodcastPeer::URL)) $criteria->add(ImportedPodcastPeer::URL, $this->url); if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST, $this->auto_ingest); - if ($this->isColumnModified(ImportedPodcastPeer::ID)) $criteria->add(ImportedPodcastPeer::ID, $this->id); - if ($this->isColumnModified(ImportedPodcastPeer::TITLE)) $criteria->add(ImportedPodcastPeer::TITLE, $this->title); - if ($this->isColumnModified(ImportedPodcastPeer::CREATOR)) $criteria->add(ImportedPodcastPeer::CREATOR, $this->creator); - if ($this->isColumnModified(ImportedPodcastPeer::DESCRIPTION)) $criteria->add(ImportedPodcastPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(ImportedPodcastPeer::LANGUAGE)) $criteria->add(ImportedPodcastPeer::LANGUAGE, $this->language); - if ($this->isColumnModified(ImportedPodcastPeer::COPYRIGHT)) $criteria->add(ImportedPodcastPeer::COPYRIGHT, $this->copyright); - if ($this->isColumnModified(ImportedPodcastPeer::LINK)) $criteria->add(ImportedPodcastPeer::LINK, $this->link); - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_AUTHOR)) $criteria->add(ImportedPodcastPeer::ITUNES_AUTHOR, $this->itunes_author); - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_KEYWORDS)) $criteria->add(ImportedPodcastPeer::ITUNES_KEYWORDS, $this->itunes_keywords); - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_SUMMARY)) $criteria->add(ImportedPodcastPeer::ITUNES_SUMMARY, $this->itunes_summary); - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_SUBTITLE)) $criteria->add(ImportedPodcastPeer::ITUNES_SUBTITLE, $this->itunes_subtitle); - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_CATEGORY)) $criteria->add(ImportedPodcastPeer::ITUNES_CATEGORY, $this->itunes_category); - if ($this->isColumnModified(ImportedPodcastPeer::ITUNES_EXPLICIT)) $criteria->add(ImportedPodcastPeer::ITUNES_EXPLICIT, $this->itunes_explicit); - if ($this->isColumnModified(ImportedPodcastPeer::OWNER)) $criteria->add(ImportedPodcastPeer::OWNER, $this->owner); + if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) $criteria->add(ImportedPodcastPeer::PODCAST_ID, $this->podcast_id); return $criteria; } @@ -1581,19 +910,7 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent { $copyObj->setDbUrl($this->getDbUrl()); $copyObj->setDbAutoIngest($this->getDbAutoIngest()); - $copyObj->setDbTitle($this->getDbTitle()); - $copyObj->setDbCreator($this->getDbCreator()); - $copyObj->setDbDescription($this->getDbDescription()); - $copyObj->setDbLanguage($this->getDbLanguage()); - $copyObj->setDbCopyright($this->getDbCopyright()); - $copyObj->setDbLink($this->getDbLink()); - $copyObj->setDbItunesAuthor($this->getDbItunesAuthor()); - $copyObj->setDbItunesKeywords($this->getDbItunesKeywords()); - $copyObj->setDbItunesSummary($this->getDbItunesSummary()); - $copyObj->setDbItunesSubtitle($this->getDbItunesSubtitle()); - $copyObj->setDbItunesCategory($this->getDbItunesCategory()); - $copyObj->setDbItunesExplicit($this->getDbItunesExplicit()); - $copyObj->setDbOwner($this->getDbOwner()); + $copyObj->setDbPodcastId($this->getDbPodcastId()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1602,11 +919,6 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent // store object hash to prevent cycle $this->startCopy = true; - $relObj = $this->getPodcast(); - if ($relObj) { - $copyObj->setPodcast($relObj->copy($deepCopy)); - } - //unflag object copy $this->startCopy = false; } // if ($deepCopy) @@ -1667,16 +979,17 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent public function setPodcast(Podcast $v = null) { if ($v === null) { - $this->setDbId(NULL); + $this->setDbPodcastId(NULL); } else { - $this->setDbId($v->getDbId()); + $this->setDbPodcastId($v->getDbId()); } $this->aPodcast = $v; - // Add binding for other direction of this 1:1 relationship. + // 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->setImportedPodcast($this); + $v->addImportedPodcast($this); } @@ -1694,65 +1007,18 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent */ public function getPodcast(PropelPDO $con = null, $doQuery = true) { - if ($this->aPodcast === null && ($this->id !== null) && $doQuery) { - $this->aPodcast = PodcastQuery::create()->findPk($this->id, $con); - // Because this foreign key represents a one-to-one relationship, we will create a bi-directional association. - $this->aPodcast->setImportedPodcast($this); - } - - return $this->aPodcast; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return ImportedPodcast The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setDbOwner(NULL); - } else { - $this->setDbOwner($v->getDbId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addImportedPodcast($this); - } - - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null, $doQuery = true) - { - if ($this->aCcSubjs === null && ($this->owner !== null) && $doQuery) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->owner, $con); + 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->aCcSubjs->addImportedPodcasts($this); + $this->aPodcast->addImportedPodcasts($this); */ } - return $this->aCcSubjs; + return $this->aPodcast; } /** @@ -1760,22 +1026,10 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent */ public function clear() { + $this->id = null; $this->url = null; $this->auto_ingest = null; - $this->id = null; - $this->title = null; - $this->creator = null; - $this->description = null; - $this->language = null; - $this->copyright = null; - $this->link = null; - $this->itunes_author = null; - $this->itunes_keywords = null; - $this->itunes_summary = null; - $this->itunes_subtitle = null; - $this->itunes_category = null; - $this->itunes_explicit = null; - $this->owner = null; + $this->podcast_id = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; @@ -1802,15 +1056,11 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent if ($this->aPodcast instanceof Persistent) { $this->aPodcast->clearAllReferences($deep); } - if ($this->aCcSubjs instanceof Persistent) { - $this->aCcSubjs->clearAllReferences($deep); - } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) $this->aPodcast = null; - $this->aCcSubjs = null; } /** @@ -1833,66 +1083,24 @@ abstract class BaseImportedPodcast extends Podcast implements Persistent return $this->alreadyInSave; } - // concrete_inheritance behavior - /** - * Get or Create the parent Podcast object of the current object - * - * @return Podcast The parent object + * Catches calls to virtual methods */ - public function getParentOrCreate($con = null) + public function __call($name, $params) { - if ($this->isNew()) { - if ($this->isPrimaryKeyNull()) { - //this prevent issue with deep copy & save parent object - if (null === ($parent = $this->getPodcast($con))) { - $parent = new Podcast(); - } - $parent->setDescendantClass('ImportedPodcast'); - return $parent; - } else { - $parent = PodcastQuery::create()->findPk($this->getPrimaryKey(), $con); - if (null === $parent || null !== $parent->getDescendantClass()) { - $parent = new Podcast(); - $parent->setPrimaryKey($this->getPrimaryKey()); - $parent->setDescendantClass('ImportedPodcast'); - } + // delegate behavior - return $parent; + 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 PodcastQuery::create()->findPk($this->getPrimaryKey(), $con); - } - - /** - * Create or Update the parent Podcast object - * And return its primary key - * - * @return int The primary key of the parent object - */ - public function getSyncParent($con = null) - { - $parent = $this->getParentOrCreate($con); - $parent->setDbTitle($this->getDbTitle()); - $parent->setDbCreator($this->getDbCreator()); - $parent->setDbDescription($this->getDbDescription()); - $parent->setDbLanguage($this->getDbLanguage()); - $parent->setDbCopyright($this->getDbCopyright()); - $parent->setDbLink($this->getDbLink()); - $parent->setDbItunesAuthor($this->getDbItunesAuthor()); - $parent->setDbItunesKeywords($this->getDbItunesKeywords()); - $parent->setDbItunesSummary($this->getDbItunesSummary()); - $parent->setDbItunesSubtitle($this->getDbItunesSubtitle()); - $parent->setDbItunesCategory($this->getDbItunesCategory()); - $parent->setDbItunesExplicit($this->getDbItunesExplicit()); - $parent->setDbOwner($this->getDbOwner()); - if ($this->getCcSubjs() && $this->getCcSubjs()->isNew()) { - $parent->setCcSubjs($this->getCcSubjs()); - } - - return $parent; + return parent::__call($name, $params); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php index 710b5b2ec..1c49a0082 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php @@ -8,7 +8,7 @@ * * @package propel.generator.airtime.om */ -abstract class BaseImportedPodcastPeer extends PodcastPeer +abstract class BaseImportedPodcastPeer { /** the default database name for this class */ @@ -24,13 +24,16 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer const TM_CLASS = 'ImportedPodcastTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 16; + const NUM_COLUMNS = 4; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 16; + const NUM_HYDRATE_COLUMNS = 4; + + /** the column name for the id field */ + const ID = 'imported_podcast.id'; /** the column name for the url field */ const URL = 'imported_podcast.url'; @@ -38,47 +41,8 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer /** the column name for the auto_ingest field */ const AUTO_INGEST = 'imported_podcast.auto_ingest'; - /** the column name for the id field */ - const ID = 'imported_podcast.id'; - - /** the column name for the title field */ - const TITLE = 'imported_podcast.title'; - - /** the column name for the creator field */ - const CREATOR = 'imported_podcast.creator'; - - /** the column name for the description field */ - const DESCRIPTION = 'imported_podcast.description'; - - /** the column name for the language field */ - const LANGUAGE = 'imported_podcast.language'; - - /** the column name for the copyright field */ - const COPYRIGHT = 'imported_podcast.copyright'; - - /** the column name for the link field */ - const LINK = 'imported_podcast.link'; - - /** the column name for the itunes_author field */ - const ITUNES_AUTHOR = 'imported_podcast.itunes_author'; - - /** the column name for the itunes_keywords field */ - const ITUNES_KEYWORDS = 'imported_podcast.itunes_keywords'; - - /** the column name for the itunes_summary field */ - const ITUNES_SUMMARY = 'imported_podcast.itunes_summary'; - - /** the column name for the itunes_subtitle field */ - const ITUNES_SUBTITLE = 'imported_podcast.itunes_subtitle'; - - /** the column name for the itunes_category field */ - const ITUNES_CATEGORY = 'imported_podcast.itunes_category'; - - /** the column name for the itunes_explicit field */ - const ITUNES_EXPLICIT = 'imported_podcast.itunes_explicit'; - - /** the column name for the owner field */ - const OWNER = 'imported_podcast.owner'; + /** the column name for the podcast_id field */ + const PODCAST_ID = 'imported_podcast.podcast_id'; /** The default string format for model objects of the related table **/ const DEFAULT_STRING_FORMAT = 'YAML'; @@ -99,12 +63,12 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer * e.g. ImportedPodcastPeer::$fieldNames[ImportedPodcastPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbUrl', 'DbAutoIngest', 'DbId', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbLink', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbOwner', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbUrl', 'dbAutoIngest', 'dbId', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbLink', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbOwner', ), - BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::URL, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::ID, ImportedPodcastPeer::TITLE, ImportedPodcastPeer::CREATOR, ImportedPodcastPeer::DESCRIPTION, ImportedPodcastPeer::LANGUAGE, ImportedPodcastPeer::COPYRIGHT, ImportedPodcastPeer::LINK, ImportedPodcastPeer::ITUNES_AUTHOR, ImportedPodcastPeer::ITUNES_KEYWORDS, ImportedPodcastPeer::ITUNES_SUMMARY, ImportedPodcastPeer::ITUNES_SUBTITLE, ImportedPodcastPeer::ITUNES_CATEGORY, ImportedPodcastPeer::ITUNES_EXPLICIT, ImportedPodcastPeer::OWNER, ), - BasePeer::TYPE_RAW_COLNAME => array ('URL', 'AUTO_INGEST', 'ID', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'LINK', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'OWNER', ), - BasePeer::TYPE_FIELDNAME => array ('url', 'auto_ingest', 'id', 'title', 'creator', 'description', 'language', 'copyright', 'link', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'owner', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbUrl', 'DbAutoIngest', 'DbPodcastId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUrl', 'dbAutoIngest', 'dbPodcastId', ), + BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::URL, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::PODCAST_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'URL', 'AUTO_INGEST', 'PODCAST_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'url', 'auto_ingest', 'podcast_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); /** @@ -114,12 +78,12 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer * e.g. ImportedPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbUrl' => 0, 'DbAutoIngest' => 1, 'DbId' => 2, 'DbTitle' => 3, 'DbCreator' => 4, 'DbDescription' => 5, 'DbLanguage' => 6, 'DbCopyright' => 7, 'DbLink' => 8, 'DbItunesAuthor' => 9, 'DbItunesKeywords' => 10, 'DbItunesSummary' => 11, 'DbItunesSubtitle' => 12, 'DbItunesCategory' => 13, 'DbItunesExplicit' => 14, 'DbOwner' => 15, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbUrl' => 0, 'dbAutoIngest' => 1, 'dbId' => 2, 'dbTitle' => 3, 'dbCreator' => 4, 'dbDescription' => 5, 'dbLanguage' => 6, 'dbCopyright' => 7, 'dbLink' => 8, 'dbItunesAuthor' => 9, 'dbItunesKeywords' => 10, 'dbItunesSummary' => 11, 'dbItunesSubtitle' => 12, 'dbItunesCategory' => 13, 'dbItunesExplicit' => 14, 'dbOwner' => 15, ), - BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::URL => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::ID => 2, ImportedPodcastPeer::TITLE => 3, ImportedPodcastPeer::CREATOR => 4, ImportedPodcastPeer::DESCRIPTION => 5, ImportedPodcastPeer::LANGUAGE => 6, ImportedPodcastPeer::COPYRIGHT => 7, ImportedPodcastPeer::LINK => 8, ImportedPodcastPeer::ITUNES_AUTHOR => 9, ImportedPodcastPeer::ITUNES_KEYWORDS => 10, ImportedPodcastPeer::ITUNES_SUMMARY => 11, ImportedPodcastPeer::ITUNES_SUBTITLE => 12, ImportedPodcastPeer::ITUNES_CATEGORY => 13, ImportedPodcastPeer::ITUNES_EXPLICIT => 14, ImportedPodcastPeer::OWNER => 15, ), - BasePeer::TYPE_RAW_COLNAME => array ('URL' => 0, 'AUTO_INGEST' => 1, 'ID' => 2, 'TITLE' => 3, 'CREATOR' => 4, 'DESCRIPTION' => 5, 'LANGUAGE' => 6, 'COPYRIGHT' => 7, 'LINK' => 8, 'ITUNES_AUTHOR' => 9, 'ITUNES_KEYWORDS' => 10, 'ITUNES_SUMMARY' => 11, 'ITUNES_SUBTITLE' => 12, 'ITUNES_CATEGORY' => 13, 'ITUNES_EXPLICIT' => 14, 'OWNER' => 15, ), - BasePeer::TYPE_FIELDNAME => array ('url' => 0, 'auto_ingest' => 1, 'id' => 2, 'title' => 3, 'creator' => 4, 'description' => 5, 'language' => 6, 'copyright' => 7, 'link' => 8, 'itunes_author' => 9, 'itunes_keywords' => 10, 'itunes_summary' => 11, 'itunes_subtitle' => 12, 'itunes_category' => 13, 'itunes_explicit' => 14, 'owner' => 15, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbUrl' => 1, 'DbAutoIngest' => 2, 'DbPodcastId' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUrl' => 1, 'dbAutoIngest' => 2, 'dbPodcastId' => 3, ), + BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::URL => 1, ImportedPodcastPeer::AUTO_INGEST => 2, ImportedPodcastPeer::PODCAST_ID => 3, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'URL' => 1, 'AUTO_INGEST' => 2, 'PODCAST_ID' => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'url' => 1, 'auto_ingest' => 2, 'podcast_id' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) ); /** @@ -193,39 +157,15 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { + $criteria->addSelectColumn(ImportedPodcastPeer::ID); $criteria->addSelectColumn(ImportedPodcastPeer::URL); $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST); - $criteria->addSelectColumn(ImportedPodcastPeer::ID); - $criteria->addSelectColumn(ImportedPodcastPeer::TITLE); - $criteria->addSelectColumn(ImportedPodcastPeer::CREATOR); - $criteria->addSelectColumn(ImportedPodcastPeer::DESCRIPTION); - $criteria->addSelectColumn(ImportedPodcastPeer::LANGUAGE); - $criteria->addSelectColumn(ImportedPodcastPeer::COPYRIGHT); - $criteria->addSelectColumn(ImportedPodcastPeer::LINK); - $criteria->addSelectColumn(ImportedPodcastPeer::ITUNES_AUTHOR); - $criteria->addSelectColumn(ImportedPodcastPeer::ITUNES_KEYWORDS); - $criteria->addSelectColumn(ImportedPodcastPeer::ITUNES_SUMMARY); - $criteria->addSelectColumn(ImportedPodcastPeer::ITUNES_SUBTITLE); - $criteria->addSelectColumn(ImportedPodcastPeer::ITUNES_CATEGORY); - $criteria->addSelectColumn(ImportedPodcastPeer::ITUNES_EXPLICIT); - $criteria->addSelectColumn(ImportedPodcastPeer::OWNER); + $criteria->addSelectColumn(ImportedPodcastPeer::PODCAST_ID); } else { + $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.url'); $criteria->addSelectColumn($alias . '.auto_ingest'); - $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.title'); - $criteria->addSelectColumn($alias . '.creator'); - $criteria->addSelectColumn($alias . '.description'); - $criteria->addSelectColumn($alias . '.language'); - $criteria->addSelectColumn($alias . '.copyright'); - $criteria->addSelectColumn($alias . '.link'); - $criteria->addSelectColumn($alias . '.itunes_author'); - $criteria->addSelectColumn($alias . '.itunes_keywords'); - $criteria->addSelectColumn($alias . '.itunes_summary'); - $criteria->addSelectColumn($alias . '.itunes_subtitle'); - $criteria->addSelectColumn($alias . '.itunes_category'); - $criteria->addSelectColumn($alias . '.itunes_explicit'); - $criteria->addSelectColumn($alias . '.owner'); + $criteria->addSelectColumn($alias . '.podcast_id'); } } @@ -445,11 +385,11 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer public static function getPrimaryKeyHashFromRow($row, $startcol = 0) { // If the PK cannot be derived from the row, return null. - if ($row[$startcol + 2] === null) { + if ($row[$startcol] === null) { return null; } - return (string) $row[$startcol + 2]; + return (string) $row[$startcol]; } /** @@ -464,7 +404,7 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer public static function getPrimaryKeyFromRow($row, $startcol = 0) { - return (int) $row[$startcol + 2]; + return (int) $row[$startcol]; } /** @@ -563,58 +503,7 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); } - $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ImportedPodcastPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ImportedPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(ImportedPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doCount($criteria, $con); @@ -651,7 +540,7 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer $startcol = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS; PodcastPeer::addSelectColumns($criteria); - $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); + $criteria->addJoin(ImportedPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -684,74 +573,6 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer } // if obj2 already loaded // Add the $obj1 (ImportedPodcast) to $obj2 (Podcast) - // one to one relationship - $obj1->setPodcast($obj2); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Selects a collection of ImportedPodcast objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ImportedPodcast objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); - } - - ImportedPodcastPeer::addSelectColumns($criteria); - $startcol = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS; - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(ImportedPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ImportedPodcastPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = ImportedPodcastPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ImportedPodcastPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (ImportedPodcast) to $obj2 (CcSubjs) $obj2->addImportedPodcast($obj1); } // if joined row was not null @@ -800,9 +621,7 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); } - $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - $criteria->addJoin(ImportedPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(ImportedPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doCount($criteria, $con); @@ -841,12 +660,7 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer PodcastPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS; - CcSubjsPeer::addSelectColumns($criteria); - $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - $criteria->addJoin(ImportedPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(ImportedPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -880,276 +694,8 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer } // if obj2 loaded // Add the $obj1 (ImportedPodcast) to the collection in $obj2 (Podcast) - $obj1->setPodcast($obj2); - } // if joined row not null - - // Add objects for joined CcSubjs rows - - $key3 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol3); - if ($key3 !== null) { - $obj3 = CcSubjsPeer::getInstanceFromPool($key3); - if (!$obj3) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj3 = new $cls(); - $obj3->hydrate($row, $startcol3); - CcSubjsPeer::addInstanceToPool($obj3, $key3); - } // if obj3 loaded - - // Add the $obj1 (ImportedPodcast) to the collection in $obj3 (CcSubjs) - $obj3->addImportedPodcast($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining the related Podcast table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAllExceptPodcast(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ImportedPodcastPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect count - - // Set the correct dbName - $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ImportedPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAllExceptCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - ImportedPodcastPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect count - - // Set the correct dbName - $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Selects a collection of ImportedPodcast objects pre-filled with all related objects except Podcast. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ImportedPodcast objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptPodcast(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); - } - - ImportedPodcastPeer::addSelectColumns($criteria); - $startcol2 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS; - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ImportedPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); - - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ImportedPodcastPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ImportedPodcastPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ImportedPodcastPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (ImportedPodcast) to the collection in $obj2 (CcSubjs) $obj2->addImportedPodcast($obj1); - - } // if joined row is not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Selects a collection of ImportedPodcast objects pre-filled with all related objects except CcSubjs. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of ImportedPodcast objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); - } - - ImportedPodcastPeer::addSelectColumns($criteria); - $startcol2 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS; - - PodcastPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = ImportedPodcastPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = ImportedPodcastPeer::getOMClass(); - - $obj1 = new $cls(); - $obj1->hydrate($row); - ImportedPodcastPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined Podcast rows - - $key2 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = PodcastPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = PodcastPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - PodcastPeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (ImportedPodcast) to the collection in $obj2 (Podcast) - $obj1->setPodcast($obj2); - - } // if joined row is not null + } // if joined row not null $results[] = $obj1; } @@ -1213,6 +759,10 @@ abstract class BaseImportedPodcastPeer extends PodcastPeer $criteria = $values->buildCriteria(); // build Criteria from ImportedPodcast object } + if ($criteria->containsKey(ImportedPodcastPeer::ID) && $criteria->keyContainsValue(ImportedPodcastPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportedPodcastPeer::ID.')'); + } + // Set the correct dbName $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php index 78432daef..e76701798 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php @@ -6,39 +6,15 @@ * * * + * @method ImportedPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column * @method ImportedPodcastQuery orderByDbUrl($order = Criteria::ASC) Order by the url column * @method ImportedPodcastQuery orderByDbAutoIngest($order = Criteria::ASC) Order by the auto_ingest column - * @method ImportedPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column - * @method ImportedPodcastQuery orderByDbTitle($order = Criteria::ASC) Order by the title column - * @method ImportedPodcastQuery orderByDbCreator($order = Criteria::ASC) Order by the creator column - * @method ImportedPodcastQuery orderByDbDescription($order = Criteria::ASC) Order by the description column - * @method ImportedPodcastQuery orderByDbLanguage($order = Criteria::ASC) Order by the language column - * @method ImportedPodcastQuery orderByDbCopyright($order = Criteria::ASC) Order by the copyright column - * @method ImportedPodcastQuery orderByDbLink($order = Criteria::ASC) Order by the link column - * @method ImportedPodcastQuery orderByDbItunesAuthor($order = Criteria::ASC) Order by the itunes_author column - * @method ImportedPodcastQuery orderByDbItunesKeywords($order = Criteria::ASC) Order by the itunes_keywords column - * @method ImportedPodcastQuery orderByDbItunesSummary($order = Criteria::ASC) Order by the itunes_summary column - * @method ImportedPodcastQuery orderByDbItunesSubtitle($order = Criteria::ASC) Order by the itunes_subtitle column - * @method ImportedPodcastQuery orderByDbItunesCategory($order = Criteria::ASC) Order by the itunes_category column - * @method ImportedPodcastQuery orderByDbItunesExplicit($order = Criteria::ASC) Order by the itunes_explicit column - * @method ImportedPodcastQuery orderByDbOwner($order = Criteria::ASC) Order by the owner column + * @method ImportedPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column * + * @method ImportedPodcastQuery groupByDbId() Group by the id column * @method ImportedPodcastQuery groupByDbUrl() Group by the url column * @method ImportedPodcastQuery groupByDbAutoIngest() Group by the auto_ingest column - * @method ImportedPodcastQuery groupByDbId() Group by the id column - * @method ImportedPodcastQuery groupByDbTitle() Group by the title column - * @method ImportedPodcastQuery groupByDbCreator() Group by the creator column - * @method ImportedPodcastQuery groupByDbDescription() Group by the description column - * @method ImportedPodcastQuery groupByDbLanguage() Group by the language column - * @method ImportedPodcastQuery groupByDbCopyright() Group by the copyright column - * @method ImportedPodcastQuery groupByDbLink() Group by the link column - * @method ImportedPodcastQuery groupByDbItunesAuthor() Group by the itunes_author column - * @method ImportedPodcastQuery groupByDbItunesKeywords() Group by the itunes_keywords column - * @method ImportedPodcastQuery groupByDbItunesSummary() Group by the itunes_summary column - * @method ImportedPodcastQuery groupByDbItunesSubtitle() Group by the itunes_subtitle column - * @method ImportedPodcastQuery groupByDbItunesCategory() Group by the itunes_category column - * @method ImportedPodcastQuery groupByDbItunesExplicit() Group by the itunes_explicit column - * @method ImportedPodcastQuery groupByDbOwner() Group by the owner 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 @@ -48,49 +24,21 @@ * @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 ImportedPodcastQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation - * @method ImportedPodcastQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation - * @method ImportedPodcastQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs 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 findOneByDbUrl(string $url) Return the first ImportedPodcast filtered by the url column * @method ImportedPodcast findOneByDbAutoIngest(boolean $auto_ingest) Return the first ImportedPodcast filtered by the auto_ingest column - * @method ImportedPodcast findOneByDbTitle(string $title) Return the first ImportedPodcast filtered by the title column - * @method ImportedPodcast findOneByDbCreator(string $creator) Return the first ImportedPodcast filtered by the creator column - * @method ImportedPodcast findOneByDbDescription(string $description) Return the first ImportedPodcast filtered by the description column - * @method ImportedPodcast findOneByDbLanguage(string $language) Return the first ImportedPodcast filtered by the language column - * @method ImportedPodcast findOneByDbCopyright(string $copyright) Return the first ImportedPodcast filtered by the copyright column - * @method ImportedPodcast findOneByDbLink(string $link) Return the first ImportedPodcast filtered by the link column - * @method ImportedPodcast findOneByDbItunesAuthor(string $itunes_author) Return the first ImportedPodcast filtered by the itunes_author column - * @method ImportedPodcast findOneByDbItunesKeywords(string $itunes_keywords) Return the first ImportedPodcast filtered by the itunes_keywords column - * @method ImportedPodcast findOneByDbItunesSummary(string $itunes_summary) Return the first ImportedPodcast filtered by the itunes_summary column - * @method ImportedPodcast findOneByDbItunesSubtitle(string $itunes_subtitle) Return the first ImportedPodcast filtered by the itunes_subtitle column - * @method ImportedPodcast findOneByDbItunesCategory(string $itunes_category) Return the first ImportedPodcast filtered by the itunes_category column - * @method ImportedPodcast findOneByDbItunesExplicit(string $itunes_explicit) Return the first ImportedPodcast filtered by the itunes_explicit column - * @method ImportedPodcast findOneByDbOwner(int $owner) Return the first ImportedPodcast filtered by the owner 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 findByDbUrl(string $url) Return ImportedPodcast objects filtered by the url column * @method array findByDbAutoIngest(boolean $auto_ingest) Return ImportedPodcast objects filtered by the auto_ingest column - * @method array findByDbId(int $id) Return ImportedPodcast objects filtered by the id column - * @method array findByDbTitle(string $title) Return ImportedPodcast objects filtered by the title column - * @method array findByDbCreator(string $creator) Return ImportedPodcast objects filtered by the creator column - * @method array findByDbDescription(string $description) Return ImportedPodcast objects filtered by the description column - * @method array findByDbLanguage(string $language) Return ImportedPodcast objects filtered by the language column - * @method array findByDbCopyright(string $copyright) Return ImportedPodcast objects filtered by the copyright column - * @method array findByDbLink(string $link) Return ImportedPodcast objects filtered by the link column - * @method array findByDbItunesAuthor(string $itunes_author) Return ImportedPodcast objects filtered by the itunes_author column - * @method array findByDbItunesKeywords(string $itunes_keywords) Return ImportedPodcast objects filtered by the itunes_keywords column - * @method array findByDbItunesSummary(string $itunes_summary) Return ImportedPodcast objects filtered by the itunes_summary column - * @method array findByDbItunesSubtitle(string $itunes_subtitle) Return ImportedPodcast objects filtered by the itunes_subtitle column - * @method array findByDbItunesCategory(string $itunes_category) Return ImportedPodcast objects filtered by the itunes_category column - * @method array findByDbItunesExplicit(string $itunes_explicit) Return ImportedPodcast objects filtered by the itunes_explicit column - * @method array findByDbOwner(int $owner) Return ImportedPodcast objects filtered by the owner 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 PodcastQuery +abstract class BaseImportedPodcastQuery extends ModelCriteria { /** * Initializes internal state of BaseImportedPodcastQuery object. @@ -194,7 +142,7 @@ abstract class BaseImportedPodcastQuery extends PodcastQuery */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "url", "auto_ingest", "id", "title", "creator", "description", "language", "copyright", "link", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "owner" FROM "imported_podcast" WHERE "id" = :p0'; + $sql = 'SELECT "id", "url", "auto_ingest", "podcast_id" FROM "imported_podcast" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -283,6 +231,48 @@ abstract class BaseImportedPodcastQuery extends PodcastQuery return $this->addUsingAlias(ImportedPodcastPeer::ID, $keys, Criteria::IN); } + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterByDbId(1234); // WHERE id = 1234 + * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12 + * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12 + * + * + * @param mixed $dbId The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ImportedPodcastQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId)) { + $useMinMax = false; + if (isset($dbId['min'])) { + $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbId['max'])) { + $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId, $comparison); + } + /** * Filter the query on the url column * @@ -340,19 +330,19 @@ abstract class BaseImportedPodcastQuery extends PodcastQuery } /** - * Filter the query on the id column + * Filter the query on the podcast_id column * * Example usage: * - * $query->filterByDbId(1234); // WHERE id = 1234 - * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12 - * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12 + * $query->filterByDbPodcastId(1234); // WHERE podcast_id = 1234 + * $query->filterByDbPodcastId(array(12, 34)); // WHERE podcast_id IN (12, 34) + * $query->filterByDbPodcastId(array('min' => 12)); // WHERE podcast_id >= 12 + * $query->filterByDbPodcastId(array('max' => 12)); // WHERE podcast_id <= 12 * * * @see filterByPodcast() * - * @param mixed $dbId The value to use as filter. + * @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. @@ -360,16 +350,16 @@ abstract class BaseImportedPodcastQuery extends PodcastQuery * * @return ImportedPodcastQuery The current query, for fluid interface */ - public function filterByDbId($dbId = null, $comparison = null) + public function filterByDbPodcastId($dbPodcastId = null, $comparison = null) { - if (is_array($dbId)) { + if (is_array($dbPodcastId)) { $useMinMax = false; - if (isset($dbId['min'])) { - $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL); + if (isset($dbPodcastId['min'])) { + $this->addUsingAlias(ImportedPodcastPeer::PODCAST_ID, $dbPodcastId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($dbId['max'])) { - $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId['max'], Criteria::LESS_EQUAL); + if (isset($dbPodcastId['max'])) { + $this->addUsingAlias(ImportedPodcastPeer::PODCAST_ID, $dbPodcastId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -380,399 +370,7 @@ abstract class BaseImportedPodcastQuery extends PodcastQuery } } - return $this->addUsingAlias(ImportedPodcastPeer::ID, $dbId, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByDbTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByDbTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $dbTitle The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbTitle($dbTitle = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbTitle)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbTitle)) { - $dbTitle = str_replace('*', '%', $dbTitle); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::TITLE, $dbTitle, $comparison); - } - - /** - * Filter the query on the creator column - * - * Example usage: - * - * $query->filterByDbCreator('fooValue'); // WHERE creator = 'fooValue' - * $query->filterByDbCreator('%fooValue%'); // WHERE creator LIKE '%fooValue%' - * - * - * @param string $dbCreator The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbCreator($dbCreator = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbCreator)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbCreator)) { - $dbCreator = str_replace('*', '%', $dbCreator); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::CREATOR, $dbCreator, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $dbDescription The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery 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(ImportedPodcastPeer::DESCRIPTION, $dbDescription, $comparison); - } - - /** - * Filter the query on the language column - * - * Example usage: - * - * $query->filterByDbLanguage('fooValue'); // WHERE language = 'fooValue' - * $query->filterByDbLanguage('%fooValue%'); // WHERE language LIKE '%fooValue%' - * - * - * @param string $dbLanguage The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbLanguage($dbLanguage = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbLanguage)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbLanguage)) { - $dbLanguage = str_replace('*', '%', $dbLanguage); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::LANGUAGE, $dbLanguage, $comparison); - } - - /** - * Filter the query on the copyright column - * - * Example usage: - * - * $query->filterByDbCopyright('fooValue'); // WHERE copyright = 'fooValue' - * $query->filterByDbCopyright('%fooValue%'); // WHERE copyright LIKE '%fooValue%' - * - * - * @param string $dbCopyright The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbCopyright($dbCopyright = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbCopyright)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbCopyright)) { - $dbCopyright = str_replace('*', '%', $dbCopyright); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::COPYRIGHT, $dbCopyright, $comparison); - } - - /** - * Filter the query on the link column - * - * Example usage: - * - * $query->filterByDbLink('fooValue'); // WHERE link = 'fooValue' - * $query->filterByDbLink('%fooValue%'); // WHERE link LIKE '%fooValue%' - * - * - * @param string $dbLink The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbLink($dbLink = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbLink)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbLink)) { - $dbLink = str_replace('*', '%', $dbLink); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::LINK, $dbLink, $comparison); - } - - /** - * Filter the query on the itunes_author column - * - * Example usage: - * - * $query->filterByDbItunesAuthor('fooValue'); // WHERE itunes_author = 'fooValue' - * $query->filterByDbItunesAuthor('%fooValue%'); // WHERE itunes_author LIKE '%fooValue%' - * - * - * @param string $dbItunesAuthor The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesAuthor($dbItunesAuthor = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesAuthor)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesAuthor)) { - $dbItunesAuthor = str_replace('*', '%', $dbItunesAuthor); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::ITUNES_AUTHOR, $dbItunesAuthor, $comparison); - } - - /** - * Filter the query on the itunes_keywords column - * - * Example usage: - * - * $query->filterByDbItunesKeywords('fooValue'); // WHERE itunes_keywords = 'fooValue' - * $query->filterByDbItunesKeywords('%fooValue%'); // WHERE itunes_keywords LIKE '%fooValue%' - * - * - * @param string $dbItunesKeywords The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesKeywords($dbItunesKeywords = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesKeywords)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesKeywords)) { - $dbItunesKeywords = str_replace('*', '%', $dbItunesKeywords); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::ITUNES_KEYWORDS, $dbItunesKeywords, $comparison); - } - - /** - * Filter the query on the itunes_summary column - * - * Example usage: - * - * $query->filterByDbItunesSummary('fooValue'); // WHERE itunes_summary = 'fooValue' - * $query->filterByDbItunesSummary('%fooValue%'); // WHERE itunes_summary LIKE '%fooValue%' - * - * - * @param string $dbItunesSummary The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesSummary($dbItunesSummary = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesSummary)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesSummary)) { - $dbItunesSummary = str_replace('*', '%', $dbItunesSummary); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::ITUNES_SUMMARY, $dbItunesSummary, $comparison); - } - - /** - * Filter the query on the itunes_subtitle column - * - * Example usage: - * - * $query->filterByDbItunesSubtitle('fooValue'); // WHERE itunes_subtitle = 'fooValue' - * $query->filterByDbItunesSubtitle('%fooValue%'); // WHERE itunes_subtitle LIKE '%fooValue%' - * - * - * @param string $dbItunesSubtitle The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesSubtitle($dbItunesSubtitle = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesSubtitle)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesSubtitle)) { - $dbItunesSubtitle = str_replace('*', '%', $dbItunesSubtitle); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::ITUNES_SUBTITLE, $dbItunesSubtitle, $comparison); - } - - /** - * Filter the query on the itunes_category column - * - * Example usage: - * - * $query->filterByDbItunesCategory('fooValue'); // WHERE itunes_category = 'fooValue' - * $query->filterByDbItunesCategory('%fooValue%'); // WHERE itunes_category LIKE '%fooValue%' - * - * - * @param string $dbItunesCategory The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesCategory($dbItunesCategory = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesCategory)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesCategory)) { - $dbItunesCategory = str_replace('*', '%', $dbItunesCategory); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::ITUNES_CATEGORY, $dbItunesCategory, $comparison); - } - - /** - * Filter the query on the itunes_explicit column - * - * Example usage: - * - * $query->filterByDbItunesExplicit('fooValue'); // WHERE itunes_explicit = 'fooValue' - * $query->filterByDbItunesExplicit('%fooValue%'); // WHERE itunes_explicit LIKE '%fooValue%' - * - * - * @param string $dbItunesExplicit The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesExplicit($dbItunesExplicit = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesExplicit)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesExplicit)) { - $dbItunesExplicit = str_replace('*', '%', $dbItunesExplicit); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::ITUNES_EXPLICIT, $dbItunesExplicit, $comparison); - } - - /** - * Filter the query on the owner column - * - * Example usage: - * - * $query->filterByDbOwner(1234); // WHERE owner = 1234 - * $query->filterByDbOwner(array(12, 34)); // WHERE owner IN (12, 34) - * $query->filterByDbOwner(array('min' => 12)); // WHERE owner >= 12 - * $query->filterByDbOwner(array('max' => 12)); // WHERE owner <= 12 - * - * - * @see filterByCcSubjs() - * - * @param mixed $dbOwner The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function filterByDbOwner($dbOwner = null, $comparison = null) - { - if (is_array($dbOwner)) { - $useMinMax = false; - if (isset($dbOwner['min'])) { - $this->addUsingAlias(ImportedPodcastPeer::OWNER, $dbOwner['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbOwner['max'])) { - $this->addUsingAlias(ImportedPodcastPeer::OWNER, $dbOwner['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ImportedPodcastPeer::OWNER, $dbOwner, $comparison); + return $this->addUsingAlias(ImportedPodcastPeer::PODCAST_ID, $dbPodcastId, $comparison); } /** @@ -788,14 +386,14 @@ abstract class BaseImportedPodcastQuery extends PodcastQuery { if ($podcast instanceof Podcast) { return $this - ->addUsingAlias(ImportedPodcastPeer::ID, $podcast->getDbId(), $comparison); + ->addUsingAlias(ImportedPodcastPeer::PODCAST_ID, $podcast->getDbId(), $comparison); } elseif ($podcast instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ImportedPodcastPeer::ID, $podcast->toKeyValue('PrimaryKey', 'DbId'), $comparison); + ->addUsingAlias(ImportedPodcastPeer::PODCAST_ID, $podcast->toKeyValue('PrimaryKey', 'DbId'), $comparison); } else { throw new PropelException('filterByPodcast() only accepts arguments of type Podcast or PropelCollection'); } @@ -851,82 +449,6 @@ abstract class BaseImportedPodcastQuery extends PodcastQuery ->useQuery($relationAlias ? $relationAlias : 'Podcast', 'PodcastQuery'); } - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ImportedPodcastQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - if ($ccSubjs instanceof CcSubjs) { - return $this - ->addUsingAlias(ImportedPodcastPeer::OWNER, $ccSubjs->getDbId(), $comparison); - } elseif ($ccSubjs instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ImportedPodcastPeer::OWNER, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison); - } else { - throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ImportedPodcastQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BasePodcast.php b/airtime_mvc/application/models/airtime/om/BasePodcast.php index e660eab65..e66df36b5 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcast.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcast.php @@ -113,33 +113,29 @@ abstract class BasePodcast extends BaseObject implements Persistent */ protected $owner; - /** - * The value for the descendant_class field. - * @var string - */ - protected $descendant_class; - /** * @var CcSubjs */ protected $aCcSubjs; + /** + * @var PropelObjectCollection|StationPodcast[] Collection to store aggregation of StationPodcast objects. + */ + protected $collStationPodcasts; + protected $collStationPodcastsPartial; + + /** + * @var PropelObjectCollection|ImportedPodcast[] Collection to store aggregation of ImportedPodcast objects. + */ + protected $collImportedPodcasts; + protected $collImportedPodcastsPartial; + /** * @var PropelObjectCollection|PodcastEpisodes[] Collection to store aggregation of PodcastEpisodes objects. */ protected $collPodcastEpisodess; protected $collPodcastEpisodessPartial; - /** - * @var StationPodcast one-to-one related StationPodcast object - */ - protected $singleStationPodcast; - - /** - * @var ImportedPodcast one-to-one related ImportedPodcast object - */ - protected $singleImportedPodcast; - /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -160,6 +156,18 @@ abstract class BasePodcast extends BaseObject implements Persistent */ protected $alreadyInClearAllReferencesDeep = false; + /** + * An array of objects scheduled for deletion. + * @var PropelObjectCollection + */ + protected $stationPodcastsScheduledForDeletion = null; + + /** + * An array of objects scheduled for deletion. + * @var PropelObjectCollection + */ + protected $importedPodcastsScheduledForDeletion = null; + /** * An array of objects scheduled for deletion. * @var PropelObjectCollection @@ -320,17 +328,6 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->owner; } - /** - * Get the [descendant_class] column value. - * - * @return string - */ - public function getDescendantClass() - { - - return $this->descendant_class; - } - /** * Set the value of [id] column. * @@ -629,27 +626,6 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this; } // setDbOwner() - /** - * Set the value of [descendant_class] column. - * - * @param string $v new value - * @return Podcast The current object (for fluent API support) - */ - public function setDescendantClass($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->descendant_class !== $v) { - $this->descendant_class = $v; - $this->modifiedColumns[] = PodcastPeer::DESCENDANT_CLASS; - } - - - return $this; - } // setDescendantClass() - /** * Indicates whether the columns in this object are only set to default values. * @@ -696,7 +672,6 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->itunes_category = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; $this->itunes_explicit = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; $this->owner = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null; - $this->descendant_class = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null; $this->resetModified(); $this->setNew(false); @@ -706,7 +681,7 @@ abstract class BasePodcast extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 15; // 15 = PodcastPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 14; // 14 = PodcastPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating Podcast object", $e); @@ -772,12 +747,12 @@ abstract class BasePodcast extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? $this->aCcSubjs = null; + $this->collStationPodcasts = null; + + $this->collImportedPodcasts = null; + $this->collPodcastEpisodess = null; - $this->singleStationPodcast = null; - - $this->singleImportedPodcast = null; - } // if (deep) } @@ -914,6 +889,40 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->resetModified(); } + if ($this->stationPodcastsScheduledForDeletion !== null) { + if (!$this->stationPodcastsScheduledForDeletion->isEmpty()) { + StationPodcastQuery::create() + ->filterByPrimaryKeys($this->stationPodcastsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->stationPodcastsScheduledForDeletion = null; + } + } + + if ($this->collStationPodcasts !== null) { + foreach ($this->collStationPodcasts as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->importedPodcastsScheduledForDeletion !== null) { + if (!$this->importedPodcastsScheduledForDeletion->isEmpty()) { + ImportedPodcastQuery::create() + ->filterByPrimaryKeys($this->importedPodcastsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->importedPodcastsScheduledForDeletion = null; + } + } + + if ($this->collImportedPodcasts !== null) { + foreach ($this->collImportedPodcasts as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->podcastEpisodessScheduledForDeletion !== null) { if (!$this->podcastEpisodessScheduledForDeletion->isEmpty()) { PodcastEpisodesQuery::create() @@ -931,18 +940,6 @@ abstract class BasePodcast extends BaseObject implements Persistent } } - if ($this->singleStationPodcast !== null) { - if (!$this->singleStationPodcast->isDeleted() && ($this->singleStationPodcast->isNew() || $this->singleStationPodcast->isModified())) { - $affectedRows += $this->singleStationPodcast->save($con); - } - } - - if ($this->singleImportedPodcast !== null) { - if (!$this->singleImportedPodcast->isDeleted() && ($this->singleImportedPodcast->isNew() || $this->singleImportedPodcast->isModified())) { - $affectedRows += $this->singleImportedPodcast->save($con); - } - } - $this->alreadyInSave = false; } @@ -1021,9 +1018,6 @@ abstract class BasePodcast extends BaseObject implements Persistent if ($this->isColumnModified(PodcastPeer::OWNER)) { $modifiedColumns[':p' . $index++] = '"owner"'; } - if ($this->isColumnModified(PodcastPeer::DESCENDANT_CLASS)) { - $modifiedColumns[':p' . $index++] = '"descendant_class"'; - } $sql = sprintf( 'INSERT INTO "podcast" (%s) VALUES (%s)', @@ -1077,9 +1071,6 @@ abstract class BasePodcast extends BaseObject implements Persistent case '"owner"': $stmt->bindValue($identifier, $this->owner, PDO::PARAM_INT); break; - case '"descendant_class"': - $stmt->bindValue($identifier, $this->descendant_class, PDO::PARAM_STR); - break; } } $stmt->execute(); @@ -1184,23 +1175,27 @@ abstract class BasePodcast extends BaseObject implements Persistent } - if ($this->collPodcastEpisodess !== null) { - foreach ($this->collPodcastEpisodess as $referrerFK) { + if ($this->collStationPodcasts !== null) { + foreach ($this->collStationPodcasts as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } - if ($this->singleStationPodcast !== null) { - if (!$this->singleStationPodcast->validate($columns)) { - $failureMap = array_merge($failureMap, $this->singleStationPodcast->getValidationFailures()); + if ($this->collImportedPodcasts !== null) { + foreach ($this->collImportedPodcasts as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } } } - if ($this->singleImportedPodcast !== null) { - if (!$this->singleImportedPodcast->validate($columns)) { - $failureMap = array_merge($failureMap, $this->singleImportedPodcast->getValidationFailures()); + if ($this->collPodcastEpisodess !== null) { + foreach ($this->collPodcastEpisodess as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } } } @@ -1281,9 +1276,6 @@ abstract class BasePodcast extends BaseObject implements Persistent case 13: return $this->getDbOwner(); break; - case 14: - return $this->getDescendantClass(); - break; default: return null; break; @@ -1327,7 +1319,6 @@ abstract class BasePodcast extends BaseObject implements Persistent $keys[11] => $this->getDbItunesCategory(), $keys[12] => $this->getDbItunesExplicit(), $keys[13] => $this->getDbOwner(), - $keys[14] => $this->getDescendantClass(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1338,15 +1329,15 @@ abstract class BasePodcast extends BaseObject implements Persistent if (null !== $this->aCcSubjs) { $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } + if (null !== $this->collStationPodcasts) { + $result['StationPodcasts'] = $this->collStationPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + if (null !== $this->collImportedPodcasts) { + $result['ImportedPodcasts'] = $this->collImportedPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collPodcastEpisodess) { $result['PodcastEpisodess'] = $this->collPodcastEpisodess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->singleStationPodcast) { - $result['StationPodcast'] = $this->singleStationPodcast->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - if (null !== $this->singleImportedPodcast) { - $result['ImportedPodcast'] = $this->singleImportedPodcast->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } } return $result; @@ -1423,9 +1414,6 @@ abstract class BasePodcast extends BaseObject implements Persistent case 13: $this->setDbOwner($value); break; - case 14: - $this->setDescendantClass($value); - break; } // switch() } @@ -1464,7 +1452,6 @@ abstract class BasePodcast extends BaseObject implements Persistent if (array_key_exists($keys[11], $arr)) $this->setDbItunesCategory($arr[$keys[11]]); if (array_key_exists($keys[12], $arr)) $this->setDbItunesExplicit($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setDbOwner($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setDescendantClass($arr[$keys[14]]); } /** @@ -1490,7 +1477,6 @@ abstract class BasePodcast extends BaseObject implements Persistent if ($this->isColumnModified(PodcastPeer::ITUNES_CATEGORY)) $criteria->add(PodcastPeer::ITUNES_CATEGORY, $this->itunes_category); if ($this->isColumnModified(PodcastPeer::ITUNES_EXPLICIT)) $criteria->add(PodcastPeer::ITUNES_EXPLICIT, $this->itunes_explicit); if ($this->isColumnModified(PodcastPeer::OWNER)) $criteria->add(PodcastPeer::OWNER, $this->owner); - if ($this->isColumnModified(PodcastPeer::DESCENDANT_CLASS)) $criteria->add(PodcastPeer::DESCENDANT_CLASS, $this->descendant_class); return $criteria; } @@ -1567,7 +1553,6 @@ abstract class BasePodcast extends BaseObject implements Persistent $copyObj->setDbItunesCategory($this->getDbItunesCategory()); $copyObj->setDbItunesExplicit($this->getDbItunesExplicit()); $copyObj->setDbOwner($this->getDbOwner()); - $copyObj->setDescendantClass($this->getDescendantClass()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1576,22 +1561,24 @@ abstract class BasePodcast extends BaseObject implements Persistent // store object hash to prevent cycle $this->startCopy = true; + foreach ($this->getStationPodcasts() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addStationPodcast($relObj->copy($deepCopy)); + } + } + + foreach ($this->getImportedPodcasts() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addImportedPodcast($relObj->copy($deepCopy)); + } + } + foreach ($this->getPodcastEpisodess() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addPodcastEpisodes($relObj->copy($deepCopy)); } } - $relObj = $this->getStationPodcast(); - if ($relObj) { - $copyObj->setStationPodcast($relObj->copy($deepCopy)); - } - - $relObj = $this->getImportedPodcast(); - if ($relObj) { - $copyObj->setImportedPodcast($relObj->copy($deepCopy)); - } - //unflag object copy $this->startCopy = false; } // if ($deepCopy) @@ -1705,11 +1692,467 @@ abstract class BasePodcast extends BaseObject implements Persistent */ public function initRelation($relationName) { + if ('StationPodcast' == $relationName) { + $this->initStationPodcasts(); + } + if ('ImportedPodcast' == $relationName) { + $this->initImportedPodcasts(); + } if ('PodcastEpisodes' == $relationName) { $this->initPodcastEpisodess(); } } + /** + * Clears out the collStationPodcasts collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return Podcast The current object (for fluent API support) + * @see addStationPodcasts() + */ + public function clearStationPodcasts() + { + $this->collStationPodcasts = null; // important to set this to null since that means it is uninitialized + $this->collStationPodcastsPartial = null; + + return $this; + } + + /** + * reset is the collStationPodcasts collection loaded partially + * + * @return void + */ + public function resetPartialStationPodcasts($v = true) + { + $this->collStationPodcastsPartial = $v; + } + + /** + * Initializes the collStationPodcasts collection. + * + * By default this just sets the collStationPodcasts collection to an empty array (like clearcollStationPodcasts()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initStationPodcasts($overrideExisting = true) + { + if (null !== $this->collStationPodcasts && !$overrideExisting) { + return; + } + $this->collStationPodcasts = new PropelObjectCollection(); + $this->collStationPodcasts->setModel('StationPodcast'); + } + + /** + * Gets an array of StationPodcast objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this Podcast is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelObjectCollection|StationPodcast[] List of StationPodcast objects + * @throws PropelException + */ + public function getStationPodcasts($criteria = null, PropelPDO $con = null) + { + $partial = $this->collStationPodcastsPartial && !$this->isNew(); + if (null === $this->collStationPodcasts || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collStationPodcasts) { + // return empty collection + $this->initStationPodcasts(); + } else { + $collStationPodcasts = StationPodcastQuery::create(null, $criteria) + ->filterByPodcast($this) + ->find($con); + if (null !== $criteria) { + if (false !== $this->collStationPodcastsPartial && count($collStationPodcasts)) { + $this->initStationPodcasts(false); + + foreach ($collStationPodcasts as $obj) { + if (false == $this->collStationPodcasts->contains($obj)) { + $this->collStationPodcasts->append($obj); + } + } + + $this->collStationPodcastsPartial = true; + } + + $collStationPodcasts->getInternalIterator()->rewind(); + + return $collStationPodcasts; + } + + if ($partial && $this->collStationPodcasts) { + foreach ($this->collStationPodcasts as $obj) { + if ($obj->isNew()) { + $collStationPodcasts[] = $obj; + } + } + } + + $this->collStationPodcasts = $collStationPodcasts; + $this->collStationPodcastsPartial = false; + } + } + + return $this->collStationPodcasts; + } + + /** + * Sets a collection of StationPodcast objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param PropelCollection $stationPodcasts A Propel collection. + * @param PropelPDO $con Optional connection object + * @return Podcast The current object (for fluent API support) + */ + public function setStationPodcasts(PropelCollection $stationPodcasts, PropelPDO $con = null) + { + $stationPodcastsToDelete = $this->getStationPodcasts(new Criteria(), $con)->diff($stationPodcasts); + + + $this->stationPodcastsScheduledForDeletion = $stationPodcastsToDelete; + + foreach ($stationPodcastsToDelete as $stationPodcastRemoved) { + $stationPodcastRemoved->setPodcast(null); + } + + $this->collStationPodcasts = null; + foreach ($stationPodcasts as $stationPodcast) { + $this->addStationPodcast($stationPodcast); + } + + $this->collStationPodcasts = $stationPodcasts; + $this->collStationPodcastsPartial = false; + + return $this; + } + + /** + * Returns the number of related StationPodcast objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related StationPodcast objects. + * @throws PropelException + */ + public function countStationPodcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + $partial = $this->collStationPodcastsPartial && !$this->isNew(); + if (null === $this->collStationPodcasts || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collStationPodcasts) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getStationPodcasts()); + } + $query = StationPodcastQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByPodcast($this) + ->count($con); + } + + return count($this->collStationPodcasts); + } + + /** + * Method called to associate a StationPodcast object to this object + * through the StationPodcast foreign key attribute. + * + * @param StationPodcast $l StationPodcast + * @return Podcast The current object (for fluent API support) + */ + public function addStationPodcast(StationPodcast $l) + { + if ($this->collStationPodcasts === null) { + $this->initStationPodcasts(); + $this->collStationPodcastsPartial = true; + } + + if (!in_array($l, $this->collStationPodcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddStationPodcast($l); + + if ($this->stationPodcastsScheduledForDeletion and $this->stationPodcastsScheduledForDeletion->contains($l)) { + $this->stationPodcastsScheduledForDeletion->remove($this->stationPodcastsScheduledForDeletion->search($l)); + } + } + + return $this; + } + + /** + * @param StationPodcast $stationPodcast The stationPodcast object to add. + */ + protected function doAddStationPodcast($stationPodcast) + { + $this->collStationPodcasts[]= $stationPodcast; + $stationPodcast->setPodcast($this); + } + + /** + * @param StationPodcast $stationPodcast The stationPodcast object to remove. + * @return Podcast The current object (for fluent API support) + */ + public function removeStationPodcast($stationPodcast) + { + if ($this->getStationPodcasts()->contains($stationPodcast)) { + $this->collStationPodcasts->remove($this->collStationPodcasts->search($stationPodcast)); + if (null === $this->stationPodcastsScheduledForDeletion) { + $this->stationPodcastsScheduledForDeletion = clone $this->collStationPodcasts; + $this->stationPodcastsScheduledForDeletion->clear(); + } + $this->stationPodcastsScheduledForDeletion[]= clone $stationPodcast; + $stationPodcast->setPodcast(null); + } + + return $this; + } + + /** + * Clears out the collImportedPodcasts collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return Podcast The current object (for fluent API support) + * @see addImportedPodcasts() + */ + public function clearImportedPodcasts() + { + $this->collImportedPodcasts = null; // important to set this to null since that means it is uninitialized + $this->collImportedPodcastsPartial = null; + + return $this; + } + + /** + * reset is the collImportedPodcasts collection loaded partially + * + * @return void + */ + public function resetPartialImportedPodcasts($v = true) + { + $this->collImportedPodcastsPartial = $v; + } + + /** + * Initializes the collImportedPodcasts collection. + * + * By default this just sets the collImportedPodcasts collection to an empty array (like clearcollImportedPodcasts()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initImportedPodcasts($overrideExisting = true) + { + if (null !== $this->collImportedPodcasts && !$overrideExisting) { + return; + } + $this->collImportedPodcasts = new PropelObjectCollection(); + $this->collImportedPodcasts->setModel('ImportedPodcast'); + } + + /** + * Gets an array of ImportedPodcast objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this Podcast is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelObjectCollection|ImportedPodcast[] List of ImportedPodcast objects + * @throws PropelException + */ + public function getImportedPodcasts($criteria = null, PropelPDO $con = null) + { + $partial = $this->collImportedPodcastsPartial && !$this->isNew(); + if (null === $this->collImportedPodcasts || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImportedPodcasts) { + // return empty collection + $this->initImportedPodcasts(); + } else { + $collImportedPodcasts = ImportedPodcastQuery::create(null, $criteria) + ->filterByPodcast($this) + ->find($con); + if (null !== $criteria) { + if (false !== $this->collImportedPodcastsPartial && count($collImportedPodcasts)) { + $this->initImportedPodcasts(false); + + foreach ($collImportedPodcasts as $obj) { + if (false == $this->collImportedPodcasts->contains($obj)) { + $this->collImportedPodcasts->append($obj); + } + } + + $this->collImportedPodcastsPartial = true; + } + + $collImportedPodcasts->getInternalIterator()->rewind(); + + return $collImportedPodcasts; + } + + if ($partial && $this->collImportedPodcasts) { + foreach ($this->collImportedPodcasts as $obj) { + if ($obj->isNew()) { + $collImportedPodcasts[] = $obj; + } + } + } + + $this->collImportedPodcasts = $collImportedPodcasts; + $this->collImportedPodcastsPartial = false; + } + } + + return $this->collImportedPodcasts; + } + + /** + * Sets a collection of ImportedPodcast objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param PropelCollection $importedPodcasts A Propel collection. + * @param PropelPDO $con Optional connection object + * @return Podcast The current object (for fluent API support) + */ + public function setImportedPodcasts(PropelCollection $importedPodcasts, PropelPDO $con = null) + { + $importedPodcastsToDelete = $this->getImportedPodcasts(new Criteria(), $con)->diff($importedPodcasts); + + + $this->importedPodcastsScheduledForDeletion = $importedPodcastsToDelete; + + foreach ($importedPodcastsToDelete as $importedPodcastRemoved) { + $importedPodcastRemoved->setPodcast(null); + } + + $this->collImportedPodcasts = null; + foreach ($importedPodcasts as $importedPodcast) { + $this->addImportedPodcast($importedPodcast); + } + + $this->collImportedPodcasts = $importedPodcasts; + $this->collImportedPodcastsPartial = false; + + return $this; + } + + /** + * Returns the number of related ImportedPodcast objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related ImportedPodcast objects. + * @throws PropelException + */ + public function countImportedPodcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + $partial = $this->collImportedPodcastsPartial && !$this->isNew(); + if (null === $this->collImportedPodcasts || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImportedPodcasts) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getImportedPodcasts()); + } + $query = ImportedPodcastQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByPodcast($this) + ->count($con); + } + + return count($this->collImportedPodcasts); + } + + /** + * Method called to associate a ImportedPodcast object to this object + * through the ImportedPodcast foreign key attribute. + * + * @param ImportedPodcast $l ImportedPodcast + * @return Podcast The current object (for fluent API support) + */ + public function addImportedPodcast(ImportedPodcast $l) + { + if ($this->collImportedPodcasts === null) { + $this->initImportedPodcasts(); + $this->collImportedPodcastsPartial = true; + } + + if (!in_array($l, $this->collImportedPodcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddImportedPodcast($l); + + if ($this->importedPodcastsScheduledForDeletion and $this->importedPodcastsScheduledForDeletion->contains($l)) { + $this->importedPodcastsScheduledForDeletion->remove($this->importedPodcastsScheduledForDeletion->search($l)); + } + } + + return $this; + } + + /** + * @param ImportedPodcast $importedPodcast The importedPodcast object to add. + */ + protected function doAddImportedPodcast($importedPodcast) + { + $this->collImportedPodcasts[]= $importedPodcast; + $importedPodcast->setPodcast($this); + } + + /** + * @param ImportedPodcast $importedPodcast The importedPodcast object to remove. + * @return Podcast The current object (for fluent API support) + */ + public function removeImportedPodcast($importedPodcast) + { + if ($this->getImportedPodcasts()->contains($importedPodcast)) { + $this->collImportedPodcasts->remove($this->collImportedPodcasts->search($importedPodcast)); + if (null === $this->importedPodcastsScheduledForDeletion) { + $this->importedPodcastsScheduledForDeletion = clone $this->collImportedPodcasts; + $this->importedPodcastsScheduledForDeletion->clear(); + } + $this->importedPodcastsScheduledForDeletion[]= clone $importedPodcast; + $importedPodcast->setPodcast(null); + } + + return $this; + } + /** * Clears out the collPodcastEpisodess collection * @@ -1960,78 +2403,6 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->getPodcastEpisodess($query, $con); } - /** - * Gets a single StationPodcast object, which is related to this object by a one-to-one relationship. - * - * @param PropelPDO $con optional connection object - * @return StationPodcast - * @throws PropelException - */ - public function getStationPodcast(PropelPDO $con = null) - { - - if ($this->singleStationPodcast === null && !$this->isNew()) { - $this->singleStationPodcast = StationPodcastQuery::create()->findPk($this->getPrimaryKey(), $con); - } - - return $this->singleStationPodcast; - } - - /** - * Sets a single StationPodcast object as related to this object by a one-to-one relationship. - * - * @param StationPodcast $v StationPodcast - * @return Podcast The current object (for fluent API support) - * @throws PropelException - */ - public function setStationPodcast(StationPodcast $v = null) - { - $this->singleStationPodcast = $v; - - // Make sure that that the passed-in StationPodcast isn't already associated with this object - if ($v !== null && $v->getPodcast(null, false) === null) { - $v->setPodcast($this); - } - - return $this; - } - - /** - * Gets a single ImportedPodcast object, which is related to this object by a one-to-one relationship. - * - * @param PropelPDO $con optional connection object - * @return ImportedPodcast - * @throws PropelException - */ - public function getImportedPodcast(PropelPDO $con = null) - { - - if ($this->singleImportedPodcast === null && !$this->isNew()) { - $this->singleImportedPodcast = ImportedPodcastQuery::create()->findPk($this->getPrimaryKey(), $con); - } - - return $this->singleImportedPodcast; - } - - /** - * Sets a single ImportedPodcast object as related to this object by a one-to-one relationship. - * - * @param ImportedPodcast $v ImportedPodcast - * @return Podcast The current object (for fluent API support) - * @throws PropelException - */ - public function setImportedPodcast(ImportedPodcast $v = null) - { - $this->singleImportedPodcast = $v; - - // Make sure that that the passed-in ImportedPodcast isn't already associated with this object - if ($v !== null && $v->getPodcast(null, false) === null) { - $v->setPodcast($this); - } - - return $this; - } - /** * Clears the current object and sets all attributes to their default values */ @@ -2051,7 +2422,6 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->itunes_category = null; $this->itunes_explicit = null; $this->owner = null; - $this->descendant_class = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; @@ -2074,17 +2444,21 @@ abstract class BasePodcast extends BaseObject implements Persistent { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; + if ($this->collStationPodcasts) { + foreach ($this->collStationPodcasts as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collImportedPodcasts) { + foreach ($this->collImportedPodcasts as $o) { + $o->clearAllReferences($deep); + } + } if ($this->collPodcastEpisodess) { foreach ($this->collPodcastEpisodess as $o) { $o->clearAllReferences($deep); } } - if ($this->singleStationPodcast) { - $this->singleStationPodcast->clearAllReferences($deep); - } - if ($this->singleImportedPodcast) { - $this->singleImportedPodcast->clearAllReferences($deep); - } if ($this->aCcSubjs instanceof Persistent) { $this->aCcSubjs->clearAllReferences($deep); } @@ -2092,18 +2466,18 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) + if ($this->collStationPodcasts instanceof PropelCollection) { + $this->collStationPodcasts->clearIterator(); + } + $this->collStationPodcasts = null; + if ($this->collImportedPodcasts instanceof PropelCollection) { + $this->collImportedPodcasts->clearIterator(); + } + $this->collImportedPodcasts = null; if ($this->collPodcastEpisodess instanceof PropelCollection) { $this->collPodcastEpisodess->clearIterator(); } $this->collPodcastEpisodess = null; - if ($this->singleStationPodcast instanceof PropelCollection) { - $this->singleStationPodcast->clearIterator(); - } - $this->singleStationPodcast = null; - if ($this->singleImportedPodcast instanceof PropelCollection) { - $this->singleImportedPodcast->clearIterator(); - } - $this->singleImportedPodcast = null; $this->aCcSubjs = null; } @@ -2127,32 +2501,4 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->alreadyInSave; } - // concrete_inheritance_parent behavior - - /** - * Whether or not this object is the parent of a child object - * - * @return bool - */ - public function hasChildObject() - { - return $this->getDescendantClass() !== null; - } - - /** - * Get the child object of this object - * - * @return mixed - */ - public function getChildObject() - { - if (!$this->hasChildObject()) { - return null; - } - $childObjectClass = $this->getDescendantClass(); - $childObject = PropelQuery::from($childObjectClass)->findPk($this->getPrimaryKey()); - - return $childObject->hasChildObject() ? $childObject->getChildObject() : $childObject; - } - } diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php index 0ff1c372b..e4ee23dc9 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php @@ -18,19 +18,19 @@ abstract class BasePodcastPeer const TABLE_NAME = 'podcast'; /** the related Propel class for this table */ - const OM_CLASS = ''; + const OM_CLASS = 'Podcast'; /** the related TableMap class for this table */ const TM_CLASS = 'PodcastTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 15; + const NUM_COLUMNS = 14; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 15; + const NUM_HYDRATE_COLUMNS = 14; /** the column name for the id field */ const ID = 'podcast.id'; @@ -74,9 +74,6 @@ abstract class BasePodcastPeer /** the column name for the owner field */ const OWNER = 'podcast.owner'; - /** the column name for the descendant_class field */ - const DESCENDANT_CLASS = 'podcast.descendant_class'; - /** The default string format for model objects of the related table **/ const DEFAULT_STRING_FORMAT = 'YAML'; @@ -96,12 +93,12 @@ abstract class BasePodcastPeer * e.g. PodcastPeer::$fieldNames[PodcastPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbLink', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbOwner', 'DescendantClass', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbLink', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbOwner', 'descendantClass', ), - BasePeer::TYPE_COLNAME => array (PodcastPeer::ID, PodcastPeer::TITLE, PodcastPeer::CREATOR, PodcastPeer::DESCRIPTION, PodcastPeer::LANGUAGE, PodcastPeer::COPYRIGHT, PodcastPeer::LINK, PodcastPeer::ITUNES_AUTHOR, PodcastPeer::ITUNES_KEYWORDS, PodcastPeer::ITUNES_SUMMARY, PodcastPeer::ITUNES_SUBTITLE, PodcastPeer::ITUNES_CATEGORY, PodcastPeer::ITUNES_EXPLICIT, PodcastPeer::OWNER, PodcastPeer::DESCENDANT_CLASS, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'LINK', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'OWNER', 'DESCENDANT_CLASS', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'title', 'creator', 'description', 'language', 'copyright', 'link', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'owner', 'descendant_class', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbLink', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbOwner', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbLink', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbOwner', ), + BasePeer::TYPE_COLNAME => array (PodcastPeer::ID, PodcastPeer::TITLE, PodcastPeer::CREATOR, PodcastPeer::DESCRIPTION, PodcastPeer::LANGUAGE, PodcastPeer::COPYRIGHT, PodcastPeer::LINK, PodcastPeer::ITUNES_AUTHOR, PodcastPeer::ITUNES_KEYWORDS, PodcastPeer::ITUNES_SUMMARY, PodcastPeer::ITUNES_SUBTITLE, PodcastPeer::ITUNES_CATEGORY, PodcastPeer::ITUNES_EXPLICIT, PodcastPeer::OWNER, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'LINK', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'OWNER', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'title', 'creator', 'description', 'language', 'copyright', 'link', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'owner', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) ); /** @@ -111,12 +108,12 @@ abstract class BasePodcastPeer * e.g. PodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTitle' => 1, 'DbCreator' => 2, 'DbDescription' => 3, 'DbLanguage' => 4, 'DbCopyright' => 5, 'DbLink' => 6, 'DbItunesAuthor' => 7, 'DbItunesKeywords' => 8, 'DbItunesSummary' => 9, 'DbItunesSubtitle' => 10, 'DbItunesCategory' => 11, 'DbItunesExplicit' => 12, 'DbOwner' => 13, 'DescendantClass' => 14, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTitle' => 1, 'dbCreator' => 2, 'dbDescription' => 3, 'dbLanguage' => 4, 'dbCopyright' => 5, 'dbLink' => 6, 'dbItunesAuthor' => 7, 'dbItunesKeywords' => 8, 'dbItunesSummary' => 9, 'dbItunesSubtitle' => 10, 'dbItunesCategory' => 11, 'dbItunesExplicit' => 12, 'dbOwner' => 13, 'descendantClass' => 14, ), - BasePeer::TYPE_COLNAME => array (PodcastPeer::ID => 0, PodcastPeer::TITLE => 1, PodcastPeer::CREATOR => 2, PodcastPeer::DESCRIPTION => 3, PodcastPeer::LANGUAGE => 4, PodcastPeer::COPYRIGHT => 5, PodcastPeer::LINK => 6, PodcastPeer::ITUNES_AUTHOR => 7, PodcastPeer::ITUNES_KEYWORDS => 8, PodcastPeer::ITUNES_SUMMARY => 9, PodcastPeer::ITUNES_SUBTITLE => 10, PodcastPeer::ITUNES_CATEGORY => 11, PodcastPeer::ITUNES_EXPLICIT => 12, PodcastPeer::OWNER => 13, PodcastPeer::DESCENDANT_CLASS => 14, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TITLE' => 1, 'CREATOR' => 2, 'DESCRIPTION' => 3, 'LANGUAGE' => 4, 'COPYRIGHT' => 5, 'LINK' => 6, 'ITUNES_AUTHOR' => 7, 'ITUNES_KEYWORDS' => 8, 'ITUNES_SUMMARY' => 9, 'ITUNES_SUBTITLE' => 10, 'ITUNES_CATEGORY' => 11, 'ITUNES_EXPLICIT' => 12, 'OWNER' => 13, 'DESCENDANT_CLASS' => 14, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, 'creator' => 2, 'description' => 3, 'language' => 4, 'copyright' => 5, 'link' => 6, 'itunes_author' => 7, 'itunes_keywords' => 8, 'itunes_summary' => 9, 'itunes_subtitle' => 10, 'itunes_category' => 11, 'itunes_explicit' => 12, 'owner' => 13, 'descendant_class' => 14, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTitle' => 1, 'DbCreator' => 2, 'DbDescription' => 3, 'DbLanguage' => 4, 'DbCopyright' => 5, 'DbLink' => 6, 'DbItunesAuthor' => 7, 'DbItunesKeywords' => 8, 'DbItunesSummary' => 9, 'DbItunesSubtitle' => 10, 'DbItunesCategory' => 11, 'DbItunesExplicit' => 12, 'DbOwner' => 13, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTitle' => 1, 'dbCreator' => 2, 'dbDescription' => 3, 'dbLanguage' => 4, 'dbCopyright' => 5, 'dbLink' => 6, 'dbItunesAuthor' => 7, 'dbItunesKeywords' => 8, 'dbItunesSummary' => 9, 'dbItunesSubtitle' => 10, 'dbItunesCategory' => 11, 'dbItunesExplicit' => 12, 'dbOwner' => 13, ), + BasePeer::TYPE_COLNAME => array (PodcastPeer::ID => 0, PodcastPeer::TITLE => 1, PodcastPeer::CREATOR => 2, PodcastPeer::DESCRIPTION => 3, PodcastPeer::LANGUAGE => 4, PodcastPeer::COPYRIGHT => 5, PodcastPeer::LINK => 6, PodcastPeer::ITUNES_AUTHOR => 7, PodcastPeer::ITUNES_KEYWORDS => 8, PodcastPeer::ITUNES_SUMMARY => 9, PodcastPeer::ITUNES_SUBTITLE => 10, PodcastPeer::ITUNES_CATEGORY => 11, PodcastPeer::ITUNES_EXPLICIT => 12, PodcastPeer::OWNER => 13, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TITLE' => 1, 'CREATOR' => 2, 'DESCRIPTION' => 3, 'LANGUAGE' => 4, 'COPYRIGHT' => 5, 'LINK' => 6, 'ITUNES_AUTHOR' => 7, 'ITUNES_KEYWORDS' => 8, 'ITUNES_SUMMARY' => 9, 'ITUNES_SUBTITLE' => 10, 'ITUNES_CATEGORY' => 11, 'ITUNES_EXPLICIT' => 12, 'OWNER' => 13, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, 'creator' => 2, 'description' => 3, 'language' => 4, 'copyright' => 5, 'link' => 6, 'itunes_author' => 7, 'itunes_keywords' => 8, 'itunes_summary' => 9, 'itunes_subtitle' => 10, 'itunes_category' => 11, 'itunes_explicit' => 12, 'owner' => 13, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) ); /** @@ -204,7 +201,6 @@ abstract class BasePodcastPeer $criteria->addSelectColumn(PodcastPeer::ITUNES_CATEGORY); $criteria->addSelectColumn(PodcastPeer::ITUNES_EXPLICIT); $criteria->addSelectColumn(PodcastPeer::OWNER); - $criteria->addSelectColumn(PodcastPeer::DESCENDANT_CLASS); } else { $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.title'); @@ -220,7 +216,6 @@ abstract class BasePodcastPeer $criteria->addSelectColumn($alias . '.itunes_category'); $criteria->addSelectColumn($alias . '.itunes_explicit'); $criteria->addSelectColumn($alias . '.owner'); - $criteria->addSelectColumn($alias . '.descendant_class'); } } @@ -425,15 +420,15 @@ abstract class BasePodcastPeer */ public static function clearRelatedInstancePool() { - // Invalidate objects in PodcastEpisodesPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - PodcastEpisodesPeer::clearInstancePool(); // Invalidate objects in StationPodcastPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. StationPodcastPeer::clearInstancePool(); // Invalidate objects in ImportedPodcastPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. ImportedPodcastPeer::clearInstancePool(); + // Invalidate objects in PodcastEpisodesPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + PodcastEpisodesPeer::clearInstancePool(); } /** @@ -520,11 +515,6 @@ abstract class BasePodcastPeer // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, $startcol, true); // rehydrate $col = $startcol + PodcastPeer::NUM_HYDRATE_COLUMNS; - } elseif (null == $key) { - // empty resultset, probably from a left join - // since this table is abstract, we can't hydrate an empty object - $obj = null; - $col = $startcol + PodcastPeer::NUM_HYDRATE_COLUMNS; } else { $cls = PodcastPeer::OM_CLASS; $obj = new $cls(); @@ -799,10 +789,13 @@ abstract class BasePodcastPeer /** * The class that the Peer will make instances of. * - * This method must be overridden by the stub subclass, because - * Podcast is declared abstract in the schema. + * + * @return string ClassName */ - abstract public static function getOMClass($row = 0, $colnum = 0); + public static function getOMClass($row = 0, $colnum = 0) + { + return PodcastPeer::OM_CLASS; + } /** * Performs an INSERT on the database, given a Podcast or Criteria object. diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php index 8fe7fd64d..02e94cc58 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php @@ -20,7 +20,6 @@ * @method PodcastQuery orderByDbItunesCategory($order = Criteria::ASC) Order by the itunes_category column * @method PodcastQuery orderByDbItunesExplicit($order = Criteria::ASC) Order by the itunes_explicit column * @method PodcastQuery orderByDbOwner($order = Criteria::ASC) Order by the owner column - * @method PodcastQuery orderByDescendantClass($order = Criteria::ASC) Order by the descendant_class column * * @method PodcastQuery groupByDbId() Group by the id column * @method PodcastQuery groupByDbTitle() Group by the title column @@ -36,7 +35,6 @@ * @method PodcastQuery groupByDbItunesCategory() Group by the itunes_category column * @method PodcastQuery groupByDbItunesExplicit() Group by the itunes_explicit column * @method PodcastQuery groupByDbOwner() Group by the owner column - * @method PodcastQuery groupByDescendantClass() Group by the descendant_class column * * @method PodcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method PodcastQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -46,10 +44,6 @@ * @method PodcastQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation * @method PodcastQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation * - * @method PodcastQuery leftJoinPodcastEpisodes($relationAlias = null) Adds a LEFT JOIN clause to the query using the PodcastEpisodes relation - * @method PodcastQuery rightJoinPodcastEpisodes($relationAlias = null) Adds a RIGHT JOIN clause to the query using the PodcastEpisodes relation - * @method PodcastQuery innerJoinPodcastEpisodes($relationAlias = null) Adds a INNER JOIN clause to the query using the PodcastEpisodes relation - * * @method PodcastQuery leftJoinStationPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the StationPodcast relation * @method PodcastQuery rightJoinStationPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the StationPodcast relation * @method PodcastQuery innerJoinStationPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the StationPodcast relation @@ -58,6 +52,10 @@ * @method PodcastQuery rightJoinImportedPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportedPodcast relation * @method PodcastQuery innerJoinImportedPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportedPodcast relation * + * @method PodcastQuery leftJoinPodcastEpisodes($relationAlias = null) Adds a LEFT JOIN clause to the query using the PodcastEpisodes relation + * @method PodcastQuery rightJoinPodcastEpisodes($relationAlias = null) Adds a RIGHT JOIN clause to the query using the PodcastEpisodes relation + * @method PodcastQuery innerJoinPodcastEpisodes($relationAlias = null) Adds a INNER JOIN clause to the query using the PodcastEpisodes relation + * * @method Podcast findOne(PropelPDO $con = null) Return the first Podcast matching the query * @method Podcast findOneOrCreate(PropelPDO $con = null) Return the first Podcast matching the query, or a new Podcast object populated from the query conditions when no match is found * @@ -74,7 +72,6 @@ * @method Podcast findOneByDbItunesCategory(string $itunes_category) Return the first Podcast filtered by the itunes_category column * @method Podcast findOneByDbItunesExplicit(string $itunes_explicit) Return the first Podcast filtered by the itunes_explicit column * @method Podcast findOneByDbOwner(int $owner) Return the first Podcast filtered by the owner column - * @method Podcast findOneByDescendantClass(string $descendant_class) Return the first Podcast filtered by the descendant_class column * * @method array findByDbId(int $id) Return Podcast objects filtered by the id column * @method array findByDbTitle(string $title) Return Podcast objects filtered by the title column @@ -90,7 +87,6 @@ * @method array findByDbItunesCategory(string $itunes_category) Return Podcast objects filtered by the itunes_category column * @method array findByDbItunesExplicit(string $itunes_explicit) Return Podcast objects filtered by the itunes_explicit column * @method array findByDbOwner(int $owner) Return Podcast objects filtered by the owner column - * @method array findByDescendantClass(string $descendant_class) Return Podcast objects filtered by the descendant_class column * * @package propel.generator.airtime.om */ @@ -198,7 +194,7 @@ abstract class BasePodcastQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "title", "creator", "description", "language", "copyright", "link", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "owner", "descendant_class" FROM "podcast" WHERE "id" = :p0'; + $sql = 'SELECT "id", "title", "creator", "description", "language", "copyright", "link", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "owner" FROM "podcast" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -721,35 +717,6 @@ abstract class BasePodcastQuery extends ModelCriteria return $this->addUsingAlias(PodcastPeer::OWNER, $dbOwner, $comparison); } - /** - * Filter the query on the descendant_class column - * - * Example usage: - * - * $query->filterByDescendantClass('fooValue'); // WHERE descendant_class = 'fooValue' - * $query->filterByDescendantClass('%fooValue%'); // WHERE descendant_class LIKE '%fooValue%' - * - * - * @param string $descendantClass The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return PodcastQuery The current query, for fluid interface - */ - public function filterByDescendantClass($descendantClass = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($descendantClass)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $descendantClass)) { - $descendantClass = str_replace('*', '%', $descendantClass); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(PodcastPeer::DESCENDANT_CLASS, $descendantClass, $comparison); - } - /** * Filter the query by a related CcSubjs object * @@ -826,6 +793,154 @@ abstract class BasePodcastQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); } + /** + * Filter the query by a related StationPodcast object + * + * @param StationPodcast|PropelObjectCollection $stationPodcast the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByStationPodcast($stationPodcast, $comparison = null) + { + if ($stationPodcast instanceof StationPodcast) { + return $this + ->addUsingAlias(PodcastPeer::ID, $stationPodcast->getDbPodcastId(), $comparison); + } elseif ($stationPodcast instanceof PropelObjectCollection) { + return $this + ->useStationPodcastQuery() + ->filterByPrimaryKeys($stationPodcast->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByStationPodcast() only accepts arguments of type StationPodcast or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the StationPodcast relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return PodcastQuery The current query, for fluid interface + */ + public function joinStationPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('StationPodcast'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'StationPodcast'); + } + + return $this; + } + + /** + * Use the StationPodcast relation StationPodcast object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return StationPodcastQuery A secondary query class using the current class as primary query + */ + public function useStationPodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinStationPodcast($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'StationPodcast', 'StationPodcastQuery'); + } + + /** + * Filter the query by a related ImportedPodcast object + * + * @param ImportedPodcast|PropelObjectCollection $importedPodcast the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByImportedPodcast($importedPodcast, $comparison = null) + { + if ($importedPodcast instanceof ImportedPodcast) { + return $this + ->addUsingAlias(PodcastPeer::ID, $importedPodcast->getDbPodcastId(), $comparison); + } elseif ($importedPodcast instanceof PropelObjectCollection) { + return $this + ->useImportedPodcastQuery() + ->filterByPrimaryKeys($importedPodcast->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByImportedPodcast() only accepts arguments of type ImportedPodcast or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the ImportedPodcast relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return PodcastQuery The current query, for fluid interface + */ + public function joinImportedPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('ImportedPodcast'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'ImportedPodcast'); + } + + return $this; + } + + /** + * Use the ImportedPodcast relation ImportedPodcast object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ImportedPodcastQuery A secondary query class using the current class as primary query + */ + public function useImportedPodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinImportedPodcast($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ImportedPodcast', 'ImportedPodcastQuery'); + } + /** * Filter the query by a related PodcastEpisodes object * @@ -900,154 +1015,6 @@ abstract class BasePodcastQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'PodcastEpisodes', 'PodcastEpisodesQuery'); } - /** - * Filter the query by a related StationPodcast object - * - * @param StationPodcast|PropelObjectCollection $stationPodcast the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return PodcastQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByStationPodcast($stationPodcast, $comparison = null) - { - if ($stationPodcast instanceof StationPodcast) { - return $this - ->addUsingAlias(PodcastPeer::ID, $stationPodcast->getDbId(), $comparison); - } elseif ($stationPodcast instanceof PropelObjectCollection) { - return $this - ->useStationPodcastQuery() - ->filterByPrimaryKeys($stationPodcast->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByStationPodcast() only accepts arguments of type StationPodcast or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the StationPodcast relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return PodcastQuery The current query, for fluid interface - */ - public function joinStationPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('StationPodcast'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'StationPodcast'); - } - - return $this; - } - - /** - * Use the StationPodcast relation StationPodcast object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return StationPodcastQuery A secondary query class using the current class as primary query - */ - public function useStationPodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinStationPodcast($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'StationPodcast', 'StationPodcastQuery'); - } - - /** - * Filter the query by a related ImportedPodcast object - * - * @param ImportedPodcast|PropelObjectCollection $importedPodcast the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return PodcastQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByImportedPodcast($importedPodcast, $comparison = null) - { - if ($importedPodcast instanceof ImportedPodcast) { - return $this - ->addUsingAlias(PodcastPeer::ID, $importedPodcast->getDbId(), $comparison); - } elseif ($importedPodcast instanceof PropelObjectCollection) { - return $this - ->useImportedPodcastQuery() - ->filterByPrimaryKeys($importedPodcast->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByImportedPodcast() only accepts arguments of type ImportedPodcast or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the ImportedPodcast relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return PodcastQuery The current query, for fluid interface - */ - public function joinImportedPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportedPodcast'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'ImportedPodcast'); - } - - return $this; - } - - /** - * Use the ImportedPodcast relation ImportedPodcast object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ImportedPodcastQuery A secondary query class using the current class as primary query - */ - public function useImportedPodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinImportedPodcast($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportedPodcast', 'ImportedPodcastQuery'); - } - /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseStationPodcast.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcast.php index 82d101d73..5da81df34 100644 --- a/airtime_mvc/application/models/airtime/om/BaseStationPodcast.php +++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcast.php @@ -8,7 +8,7 @@ * * @package propel.generator.airtime.om */ -abstract class BaseStationPodcast extends Podcast implements Persistent +abstract class BaseStationPodcast extends BaseObject implements Persistent { /** * Peer class name @@ -36,93 +36,16 @@ abstract class BaseStationPodcast extends Podcast implements Persistent protected $id; /** - * The value for the title field. - * @var string - */ - protected $title; - - /** - * The value for the creator field. - * @var string - */ - protected $creator; - - /** - * The value for the description field. - * @var string - */ - protected $description; - - /** - * The value for the language field. - * @var string - */ - protected $language; - - /** - * The value for the copyright field. - * @var string - */ - protected $copyright; - - /** - * The value for the link field. - * @var string - */ - protected $link; - - /** - * The value for the itunes_author field. - * @var string - */ - protected $itunes_author; - - /** - * The value for the itunes_keywords field. - * @var string - */ - protected $itunes_keywords; - - /** - * The value for the itunes_summary field. - * @var string - */ - protected $itunes_summary; - - /** - * The value for the itunes_subtitle field. - * @var string - */ - protected $itunes_subtitle; - - /** - * The value for the itunes_category field. - * @var string - */ - protected $itunes_category; - - /** - * The value for the itunes_explicit field. - * @var string - */ - protected $itunes_explicit; - - /** - * The value for the owner field. + * The value for the podcast_id field. * @var int */ - protected $owner; + protected $podcast_id; /** * @var Podcast */ protected $aPodcast; - /** - * @var CcSubjs - */ - protected $aCcSubjs; - /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -155,146 +78,14 @@ abstract class BaseStationPodcast extends Podcast implements Persistent } /** - * Get the [title] column value. - * - * @return string - */ - public function getDbTitle() - { - - return $this->title; - } - - /** - * Get the [creator] column value. - * - * @return string - */ - public function getDbCreator() - { - - return $this->creator; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDbDescription() - { - - return $this->description; - } - - /** - * Get the [language] column value. - * - * @return string - */ - public function getDbLanguage() - { - - return $this->language; - } - - /** - * Get the [copyright] column value. - * - * @return string - */ - public function getDbCopyright() - { - - return $this->copyright; - } - - /** - * Get the [link] column value. - * - * @return string - */ - public function getDbLink() - { - - return $this->link; - } - - /** - * Get the [itunes_author] column value. - * - * @return string - */ - public function getDbItunesAuthor() - { - - return $this->itunes_author; - } - - /** - * Get the [itunes_keywords] column value. - * - * @return string - */ - public function getDbItunesKeywords() - { - - return $this->itunes_keywords; - } - - /** - * Get the [itunes_summary] column value. - * - * @return string - */ - public function getDbItunesSummary() - { - - return $this->itunes_summary; - } - - /** - * Get the [itunes_subtitle] column value. - * - * @return string - */ - public function getDbItunesSubtitle() - { - - return $this->itunes_subtitle; - } - - /** - * Get the [itunes_category] column value. - * - * @return string - */ - public function getDbItunesCategory() - { - - return $this->itunes_category; - } - - /** - * Get the [itunes_explicit] column value. - * - * @return string - */ - public function getDbItunesExplicit() - { - - return $this->itunes_explicit; - } - - /** - * Get the [owner] column value. + * Get the [podcast_id] column value. * * @return int */ - public function getDbOwner() + public function getDbPodcastId() { - return $this->owner; + return $this->podcast_id; } /** @@ -314,290 +105,34 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $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; - } // setDbId() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbTitle($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = StationPodcastPeer::TITLE; - } - - - return $this; - } // setDbTitle() - - /** - * Set the value of [creator] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbCreator($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->creator !== $v) { - $this->creator = $v; - $this->modifiedColumns[] = StationPodcastPeer::CREATOR; - } - - - return $this; - } // setDbCreator() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return StationPodcast 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[] = StationPodcastPeer::DESCRIPTION; - } - - - return $this; - } // setDbDescription() - - /** - * Set the value of [language] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbLanguage($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->language !== $v) { - $this->language = $v; - $this->modifiedColumns[] = StationPodcastPeer::LANGUAGE; - } - - - return $this; - } // setDbLanguage() - - /** - * Set the value of [copyright] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbCopyright($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->copyright !== $v) { - $this->copyright = $v; - $this->modifiedColumns[] = StationPodcastPeer::COPYRIGHT; - } - - - return $this; - } // setDbCopyright() - - /** - * Set the value of [link] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbLink($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->link !== $v) { - $this->link = $v; - $this->modifiedColumns[] = StationPodcastPeer::LINK; - } - - - return $this; - } // setDbLink() - - /** - * Set the value of [itunes_author] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbItunesAuthor($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_author !== $v) { - $this->itunes_author = $v; - $this->modifiedColumns[] = StationPodcastPeer::ITUNES_AUTHOR; - } - - - return $this; - } // setDbItunesAuthor() - - /** - * Set the value of [itunes_keywords] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbItunesKeywords($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_keywords !== $v) { - $this->itunes_keywords = $v; - $this->modifiedColumns[] = StationPodcastPeer::ITUNES_KEYWORDS; - } - - - return $this; - } // setDbItunesKeywords() - - /** - * Set the value of [itunes_summary] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbItunesSummary($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_summary !== $v) { - $this->itunes_summary = $v; - $this->modifiedColumns[] = StationPodcastPeer::ITUNES_SUMMARY; - } - - - return $this; - } // setDbItunesSummary() - - /** - * Set the value of [itunes_subtitle] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbItunesSubtitle($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_subtitle !== $v) { - $this->itunes_subtitle = $v; - $this->modifiedColumns[] = StationPodcastPeer::ITUNES_SUBTITLE; - } - - - return $this; - } // setDbItunesSubtitle() - - /** - * Set the value of [itunes_category] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbItunesCategory($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_category !== $v) { - $this->itunes_category = $v; - $this->modifiedColumns[] = StationPodcastPeer::ITUNES_CATEGORY; - } - - - return $this; - } // setDbItunesCategory() - - /** - * Set the value of [itunes_explicit] column. - * - * @param string $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbItunesExplicit($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->itunes_explicit !== $v) { - $this->itunes_explicit = $v; - $this->modifiedColumns[] = StationPodcastPeer::ITUNES_EXPLICIT; - } - - - return $this; - } // setDbItunesExplicit() - - /** - * Set the value of [owner] column. - * - * @param int $v new value - * @return StationPodcast The current object (for fluent API support) - */ - public function setDbOwner($v) - { - if ($v !== null && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->owner !== $v) { - $this->owner = $v; - $this->modifiedColumns[] = StationPodcastPeer::OWNER; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { - $this->aCcSubjs = null; - } - - - return $this; - } // setDbOwner() + } // setDbPodcastId() /** * Indicates whether the columns in this object are only set to default values. @@ -632,19 +167,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent try { $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->title = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->creator = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->language = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->copyright = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->link = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->itunes_author = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->itunes_keywords = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->itunes_summary = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->itunes_subtitle = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->itunes_category = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; - $this->itunes_explicit = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; - $this->owner = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null; + $this->podcast_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->resetModified(); $this->setNew(false); @@ -654,7 +177,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 14; // 14 = StationPodcastPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 2; // 2 = StationPodcastPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating StationPodcast object", $e); @@ -677,12 +200,9 @@ abstract class BaseStationPodcast extends Podcast implements Persistent public function ensureConsistency() { - if ($this->aPodcast !== null && $this->id !== $this->aPodcast->getDbId()) { + if ($this->aPodcast !== null && $this->podcast_id !== $this->aPodcast->getDbId()) { $this->aPodcast = null; } - if ($this->aCcSubjs !== null && $this->owner !== $this->aCcSubjs->getDbId()) { - $this->aCcSubjs = null; - } } // ensureConsistency /** @@ -723,7 +243,6 @@ abstract class BaseStationPodcast extends Podcast implements Persistent if ($deep) { // also de-associate any related objects? $this->aPodcast = null; - $this->aCcSubjs = null; } // if (deep) } @@ -755,9 +274,6 @@ abstract class BaseStationPodcast extends Podcast implements Persistent if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); - // concrete_inheritance behavior - $this->getParentOrCreate($con)->delete($con); - $con->commit(); $this->setDeleted(true); } else { @@ -797,11 +313,6 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $isInsert = $this->isNew(); try { $ret = $this->preSave($con); - // concrete_inheritance behavior - $parent = $this->getSyncParent($con); - $parent->save($con); - $this->setPrimaryKey($parent->getPrimaryKey()); - if ($isInsert) { $ret = $ret && $this->preInsert($con); } else { @@ -857,13 +368,6 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $this->setPodcast($this->aPodcast); } - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { @@ -895,49 +399,27 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $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::TITLE)) { - $modifiedColumns[':p' . $index++] = '"title"'; - } - if ($this->isColumnModified(StationPodcastPeer::CREATOR)) { - $modifiedColumns[':p' . $index++] = '"creator"'; - } - if ($this->isColumnModified(StationPodcastPeer::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = '"description"'; - } - if ($this->isColumnModified(StationPodcastPeer::LANGUAGE)) { - $modifiedColumns[':p' . $index++] = '"language"'; - } - if ($this->isColumnModified(StationPodcastPeer::COPYRIGHT)) { - $modifiedColumns[':p' . $index++] = '"copyright"'; - } - if ($this->isColumnModified(StationPodcastPeer::LINK)) { - $modifiedColumns[':p' . $index++] = '"link"'; - } - if ($this->isColumnModified(StationPodcastPeer::ITUNES_AUTHOR)) { - $modifiedColumns[':p' . $index++] = '"itunes_author"'; - } - if ($this->isColumnModified(StationPodcastPeer::ITUNES_KEYWORDS)) { - $modifiedColumns[':p' . $index++] = '"itunes_keywords"'; - } - if ($this->isColumnModified(StationPodcastPeer::ITUNES_SUMMARY)) { - $modifiedColumns[':p' . $index++] = '"itunes_summary"'; - } - if ($this->isColumnModified(StationPodcastPeer::ITUNES_SUBTITLE)) { - $modifiedColumns[':p' . $index++] = '"itunes_subtitle"'; - } - if ($this->isColumnModified(StationPodcastPeer::ITUNES_CATEGORY)) { - $modifiedColumns[':p' . $index++] = '"itunes_category"'; - } - if ($this->isColumnModified(StationPodcastPeer::ITUNES_EXPLICIT)) { - $modifiedColumns[':p' . $index++] = '"itunes_explicit"'; - } - if ($this->isColumnModified(StationPodcastPeer::OWNER)) { - $modifiedColumns[':p' . $index++] = '"owner"'; + if ($this->isColumnModified(StationPodcastPeer::PODCAST_ID)) { + $modifiedColumns[':p' . $index++] = '"podcast_id"'; } $sql = sprintf( @@ -953,44 +435,8 @@ abstract class BaseStationPodcast extends Podcast implements Persistent case '"id"': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case '"title"': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case '"creator"': - $stmt->bindValue($identifier, $this->creator, PDO::PARAM_STR); - break; - case '"description"': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; - case '"language"': - $stmt->bindValue($identifier, $this->language, PDO::PARAM_STR); - break; - case '"copyright"': - $stmt->bindValue($identifier, $this->copyright, PDO::PARAM_STR); - break; - case '"link"': - $stmt->bindValue($identifier, $this->link, PDO::PARAM_STR); - break; - case '"itunes_author"': - $stmt->bindValue($identifier, $this->itunes_author, PDO::PARAM_STR); - break; - case '"itunes_keywords"': - $stmt->bindValue($identifier, $this->itunes_keywords, PDO::PARAM_STR); - break; - case '"itunes_summary"': - $stmt->bindValue($identifier, $this->itunes_summary, PDO::PARAM_STR); - break; - case '"itunes_subtitle"': - $stmt->bindValue($identifier, $this->itunes_subtitle, PDO::PARAM_STR); - break; - case '"itunes_category"': - $stmt->bindValue($identifier, $this->itunes_category, PDO::PARAM_STR); - break; - case '"itunes_explicit"': - $stmt->bindValue($identifier, $this->itunes_explicit, PDO::PARAM_STR); - break; - case '"owner"': - $stmt->bindValue($identifier, $this->owner, PDO::PARAM_INT); + case '"podcast_id"': + $stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT); break; } } @@ -1090,12 +536,6 @@ abstract class BaseStationPodcast extends Podcast implements Persistent } } - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - if (($retval = StationPodcastPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); @@ -1141,43 +581,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent return $this->getDbId(); break; case 1: - return $this->getDbTitle(); - break; - case 2: - return $this->getDbCreator(); - break; - case 3: - return $this->getDbDescription(); - break; - case 4: - return $this->getDbLanguage(); - break; - case 5: - return $this->getDbCopyright(); - break; - case 6: - return $this->getDbLink(); - break; - case 7: - return $this->getDbItunesAuthor(); - break; - case 8: - return $this->getDbItunesKeywords(); - break; - case 9: - return $this->getDbItunesSummary(); - break; - case 10: - return $this->getDbItunesSubtitle(); - break; - case 11: - return $this->getDbItunesCategory(); - break; - case 12: - return $this->getDbItunesExplicit(); - break; - case 13: - return $this->getDbOwner(); + return $this->getDbPodcastId(); break; default: return null; @@ -1209,19 +613,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $keys = StationPodcastPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getDbId(), - $keys[1] => $this->getDbTitle(), - $keys[2] => $this->getDbCreator(), - $keys[3] => $this->getDbDescription(), - $keys[4] => $this->getDbLanguage(), - $keys[5] => $this->getDbCopyright(), - $keys[6] => $this->getDbLink(), - $keys[7] => $this->getDbItunesAuthor(), - $keys[8] => $this->getDbItunesKeywords(), - $keys[9] => $this->getDbItunesSummary(), - $keys[10] => $this->getDbItunesSubtitle(), - $keys[11] => $this->getDbItunesCategory(), - $keys[12] => $this->getDbItunesExplicit(), - $keys[13] => $this->getDbOwner(), + $keys[1] => $this->getDbPodcastId(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1232,9 +624,6 @@ abstract class BaseStationPodcast extends Podcast implements Persistent if (null !== $this->aPodcast) { $result['Podcast'] = $this->aPodcast->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } } return $result; @@ -1273,43 +662,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $this->setDbId($value); break; case 1: - $this->setDbTitle($value); - break; - case 2: - $this->setDbCreator($value); - break; - case 3: - $this->setDbDescription($value); - break; - case 4: - $this->setDbLanguage($value); - break; - case 5: - $this->setDbCopyright($value); - break; - case 6: - $this->setDbLink($value); - break; - case 7: - $this->setDbItunesAuthor($value); - break; - case 8: - $this->setDbItunesKeywords($value); - break; - case 9: - $this->setDbItunesSummary($value); - break; - case 10: - $this->setDbItunesSubtitle($value); - break; - case 11: - $this->setDbItunesCategory($value); - break; - case 12: - $this->setDbItunesExplicit($value); - break; - case 13: - $this->setDbOwner($value); + $this->setDbPodcastId($value); break; } // switch() } @@ -1336,19 +689,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $keys = StationPodcastPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setDbTitle($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbCreator($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbDescription($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbLanguage($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbCopyright($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDbLink($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setDbItunesAuthor($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setDbItunesKeywords($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setDbItunesSummary($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setDbItunesSubtitle($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setDbItunesCategory($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setDbItunesExplicit($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setDbOwner($arr[$keys[13]]); + if (array_key_exists($keys[1], $arr)) $this->setDbPodcastId($arr[$keys[1]]); } /** @@ -1361,19 +702,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME); if ($this->isColumnModified(StationPodcastPeer::ID)) $criteria->add(StationPodcastPeer::ID, $this->id); - if ($this->isColumnModified(StationPodcastPeer::TITLE)) $criteria->add(StationPodcastPeer::TITLE, $this->title); - if ($this->isColumnModified(StationPodcastPeer::CREATOR)) $criteria->add(StationPodcastPeer::CREATOR, $this->creator); - if ($this->isColumnModified(StationPodcastPeer::DESCRIPTION)) $criteria->add(StationPodcastPeer::DESCRIPTION, $this->description); - if ($this->isColumnModified(StationPodcastPeer::LANGUAGE)) $criteria->add(StationPodcastPeer::LANGUAGE, $this->language); - if ($this->isColumnModified(StationPodcastPeer::COPYRIGHT)) $criteria->add(StationPodcastPeer::COPYRIGHT, $this->copyright); - if ($this->isColumnModified(StationPodcastPeer::LINK)) $criteria->add(StationPodcastPeer::LINK, $this->link); - if ($this->isColumnModified(StationPodcastPeer::ITUNES_AUTHOR)) $criteria->add(StationPodcastPeer::ITUNES_AUTHOR, $this->itunes_author); - if ($this->isColumnModified(StationPodcastPeer::ITUNES_KEYWORDS)) $criteria->add(StationPodcastPeer::ITUNES_KEYWORDS, $this->itunes_keywords); - if ($this->isColumnModified(StationPodcastPeer::ITUNES_SUMMARY)) $criteria->add(StationPodcastPeer::ITUNES_SUMMARY, $this->itunes_summary); - if ($this->isColumnModified(StationPodcastPeer::ITUNES_SUBTITLE)) $criteria->add(StationPodcastPeer::ITUNES_SUBTITLE, $this->itunes_subtitle); - if ($this->isColumnModified(StationPodcastPeer::ITUNES_CATEGORY)) $criteria->add(StationPodcastPeer::ITUNES_CATEGORY, $this->itunes_category); - if ($this->isColumnModified(StationPodcastPeer::ITUNES_EXPLICIT)) $criteria->add(StationPodcastPeer::ITUNES_EXPLICIT, $this->itunes_explicit); - if ($this->isColumnModified(StationPodcastPeer::OWNER)) $criteria->add(StationPodcastPeer::OWNER, $this->owner); + if ($this->isColumnModified(StationPodcastPeer::PODCAST_ID)) $criteria->add(StationPodcastPeer::PODCAST_ID, $this->podcast_id); return $criteria; } @@ -1437,19 +766,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setDbTitle($this->getDbTitle()); - $copyObj->setDbCreator($this->getDbCreator()); - $copyObj->setDbDescription($this->getDbDescription()); - $copyObj->setDbLanguage($this->getDbLanguage()); - $copyObj->setDbCopyright($this->getDbCopyright()); - $copyObj->setDbLink($this->getDbLink()); - $copyObj->setDbItunesAuthor($this->getDbItunesAuthor()); - $copyObj->setDbItunesKeywords($this->getDbItunesKeywords()); - $copyObj->setDbItunesSummary($this->getDbItunesSummary()); - $copyObj->setDbItunesSubtitle($this->getDbItunesSubtitle()); - $copyObj->setDbItunesCategory($this->getDbItunesCategory()); - $copyObj->setDbItunesExplicit($this->getDbItunesExplicit()); - $copyObj->setDbOwner($this->getDbOwner()); + $copyObj->setDbPodcastId($this->getDbPodcastId()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1458,11 +775,6 @@ abstract class BaseStationPodcast extends Podcast implements Persistent // store object hash to prevent cycle $this->startCopy = true; - $relObj = $this->getPodcast(); - if ($relObj) { - $copyObj->setPodcast($relObj->copy($deepCopy)); - } - //unflag object copy $this->startCopy = false; } // if ($deepCopy) @@ -1523,16 +835,17 @@ abstract class BaseStationPodcast extends Podcast implements Persistent public function setPodcast(Podcast $v = null) { if ($v === null) { - $this->setDbId(NULL); + $this->setDbPodcastId(NULL); } else { - $this->setDbId($v->getDbId()); + $this->setDbPodcastId($v->getDbId()); } $this->aPodcast = $v; - // Add binding for other direction of this 1:1 relationship. + // 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->setStationPodcast($this); + $v->addStationPodcast($this); } @@ -1550,65 +863,18 @@ abstract class BaseStationPodcast extends Podcast implements Persistent */ public function getPodcast(PropelPDO $con = null, $doQuery = true) { - if ($this->aPodcast === null && ($this->id !== null) && $doQuery) { - $this->aPodcast = PodcastQuery::create()->findPk($this->id, $con); - // Because this foreign key represents a one-to-one relationship, we will create a bi-directional association. - $this->aPodcast->setStationPodcast($this); - } - - return $this->aPodcast; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return StationPodcast The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setDbOwner(NULL); - } else { - $this->setDbOwner($v->getDbId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addStationPodcast($this); - } - - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO $con Optional Connection object. - * @param $doQuery Executes a query to get the object if required - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null, $doQuery = true) - { - if ($this->aCcSubjs === null && ($this->owner !== null) && $doQuery) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->owner, $con); + 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->aCcSubjs->addStationPodcasts($this); + $this->aPodcast->addStationPodcasts($this); */ } - return $this->aCcSubjs; + return $this->aPodcast; } /** @@ -1617,19 +883,7 @@ abstract class BaseStationPodcast extends Podcast implements Persistent public function clear() { $this->id = null; - $this->title = null; - $this->creator = null; - $this->description = null; - $this->language = null; - $this->copyright = null; - $this->link = null; - $this->itunes_author = null; - $this->itunes_keywords = null; - $this->itunes_summary = null; - $this->itunes_subtitle = null; - $this->itunes_category = null; - $this->itunes_explicit = null; - $this->owner = null; + $this->podcast_id = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; @@ -1655,15 +909,11 @@ abstract class BaseStationPodcast extends Podcast implements Persistent if ($this->aPodcast instanceof Persistent) { $this->aPodcast->clearAllReferences($deep); } - if ($this->aCcSubjs instanceof Persistent) { - $this->aCcSubjs->clearAllReferences($deep); - } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) $this->aPodcast = null; - $this->aCcSubjs = null; } /** @@ -1686,66 +936,24 @@ abstract class BaseStationPodcast extends Podcast implements Persistent return $this->alreadyInSave; } - // concrete_inheritance behavior - /** - * Get or Create the parent Podcast object of the current object - * - * @return Podcast The parent object + * Catches calls to virtual methods */ - public function getParentOrCreate($con = null) + public function __call($name, $params) { - if ($this->isNew()) { - if ($this->isPrimaryKeyNull()) { - //this prevent issue with deep copy & save parent object - if (null === ($parent = $this->getPodcast($con))) { - $parent = new Podcast(); - } - $parent->setDescendantClass('StationPodcast'); - return $parent; - } else { - $parent = PodcastQuery::create()->findPk($this->getPrimaryKey(), $con); - if (null === $parent || null !== $parent->getDescendantClass()) { - $parent = new Podcast(); - $parent->setPrimaryKey($this->getPrimaryKey()); - $parent->setDescendantClass('StationPodcast'); - } + // delegate behavior - return $parent; + 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 PodcastQuery::create()->findPk($this->getPrimaryKey(), $con); - } - - /** - * Create or Update the parent Podcast object - * And return its primary key - * - * @return int The primary key of the parent object - */ - public function getSyncParent($con = null) - { - $parent = $this->getParentOrCreate($con); - $parent->setDbTitle($this->getDbTitle()); - $parent->setDbCreator($this->getDbCreator()); - $parent->setDbDescription($this->getDbDescription()); - $parent->setDbLanguage($this->getDbLanguage()); - $parent->setDbCopyright($this->getDbCopyright()); - $parent->setDbLink($this->getDbLink()); - $parent->setDbItunesAuthor($this->getDbItunesAuthor()); - $parent->setDbItunesKeywords($this->getDbItunesKeywords()); - $parent->setDbItunesSummary($this->getDbItunesSummary()); - $parent->setDbItunesSubtitle($this->getDbItunesSubtitle()); - $parent->setDbItunesCategory($this->getDbItunesCategory()); - $parent->setDbItunesExplicit($this->getDbItunesExplicit()); - $parent->setDbOwner($this->getDbOwner()); - if ($this->getCcSubjs() && $this->getCcSubjs()->isNew()) { - $parent->setCcSubjs($this->getCcSubjs()); - } - - return $parent; + return parent::__call($name, $params); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php index 2eb030911..85adc56ee 100644 --- a/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php @@ -8,7 +8,7 @@ * * @package propel.generator.airtime.om */ -abstract class BaseStationPodcastPeer extends PodcastPeer +abstract class BaseStationPodcastPeer { /** the default database name for this class */ @@ -24,55 +24,19 @@ abstract class BaseStationPodcastPeer extends PodcastPeer const TM_CLASS = 'StationPodcastTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 14; + 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 = 14; + const NUM_HYDRATE_COLUMNS = 2; /** the column name for the id field */ const ID = 'station_podcast.id'; - /** the column name for the title field */ - const TITLE = 'station_podcast.title'; - - /** the column name for the creator field */ - const CREATOR = 'station_podcast.creator'; - - /** the column name for the description field */ - const DESCRIPTION = 'station_podcast.description'; - - /** the column name for the language field */ - const LANGUAGE = 'station_podcast.language'; - - /** the column name for the copyright field */ - const COPYRIGHT = 'station_podcast.copyright'; - - /** the column name for the link field */ - const LINK = 'station_podcast.link'; - - /** the column name for the itunes_author field */ - const ITUNES_AUTHOR = 'station_podcast.itunes_author'; - - /** the column name for the itunes_keywords field */ - const ITUNES_KEYWORDS = 'station_podcast.itunes_keywords'; - - /** the column name for the itunes_summary field */ - const ITUNES_SUMMARY = 'station_podcast.itunes_summary'; - - /** the column name for the itunes_subtitle field */ - const ITUNES_SUBTITLE = 'station_podcast.itunes_subtitle'; - - /** the column name for the itunes_category field */ - const ITUNES_CATEGORY = 'station_podcast.itunes_category'; - - /** the column name for the itunes_explicit field */ - const ITUNES_EXPLICIT = 'station_podcast.itunes_explicit'; - - /** the column name for the owner field */ - const OWNER = 'station_podcast.owner'; + /** 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'; @@ -93,12 +57,12 @@ abstract class BaseStationPodcastPeer extends PodcastPeer * e.g. StationPodcastPeer::$fieldNames[StationPodcastPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbLink', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbOwner', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbLink', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbOwner', ), - BasePeer::TYPE_COLNAME => array (StationPodcastPeer::ID, StationPodcastPeer::TITLE, StationPodcastPeer::CREATOR, StationPodcastPeer::DESCRIPTION, StationPodcastPeer::LANGUAGE, StationPodcastPeer::COPYRIGHT, StationPodcastPeer::LINK, StationPodcastPeer::ITUNES_AUTHOR, StationPodcastPeer::ITUNES_KEYWORDS, StationPodcastPeer::ITUNES_SUMMARY, StationPodcastPeer::ITUNES_SUBTITLE, StationPodcastPeer::ITUNES_CATEGORY, StationPodcastPeer::ITUNES_EXPLICIT, StationPodcastPeer::OWNER, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'LINK', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'OWNER', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'title', 'creator', 'description', 'language', 'copyright', 'link', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'owner', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + 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, ) ); /** @@ -108,12 +72,12 @@ abstract class BaseStationPodcastPeer extends PodcastPeer * e.g. StationPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTitle' => 1, 'DbCreator' => 2, 'DbDescription' => 3, 'DbLanguage' => 4, 'DbCopyright' => 5, 'DbLink' => 6, 'DbItunesAuthor' => 7, 'DbItunesKeywords' => 8, 'DbItunesSummary' => 9, 'DbItunesSubtitle' => 10, 'DbItunesCategory' => 11, 'DbItunesExplicit' => 12, 'DbOwner' => 13, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTitle' => 1, 'dbCreator' => 2, 'dbDescription' => 3, 'dbLanguage' => 4, 'dbCopyright' => 5, 'dbLink' => 6, 'dbItunesAuthor' => 7, 'dbItunesKeywords' => 8, 'dbItunesSummary' => 9, 'dbItunesSubtitle' => 10, 'dbItunesCategory' => 11, 'dbItunesExplicit' => 12, 'dbOwner' => 13, ), - BasePeer::TYPE_COLNAME => array (StationPodcastPeer::ID => 0, StationPodcastPeer::TITLE => 1, StationPodcastPeer::CREATOR => 2, StationPodcastPeer::DESCRIPTION => 3, StationPodcastPeer::LANGUAGE => 4, StationPodcastPeer::COPYRIGHT => 5, StationPodcastPeer::LINK => 6, StationPodcastPeer::ITUNES_AUTHOR => 7, StationPodcastPeer::ITUNES_KEYWORDS => 8, StationPodcastPeer::ITUNES_SUMMARY => 9, StationPodcastPeer::ITUNES_SUBTITLE => 10, StationPodcastPeer::ITUNES_CATEGORY => 11, StationPodcastPeer::ITUNES_EXPLICIT => 12, StationPodcastPeer::OWNER => 13, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TITLE' => 1, 'CREATOR' => 2, 'DESCRIPTION' => 3, 'LANGUAGE' => 4, 'COPYRIGHT' => 5, 'LINK' => 6, 'ITUNES_AUTHOR' => 7, 'ITUNES_KEYWORDS' => 8, 'ITUNES_SUMMARY' => 9, 'ITUNES_SUBTITLE' => 10, 'ITUNES_CATEGORY' => 11, 'ITUNES_EXPLICIT' => 12, 'OWNER' => 13, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, 'creator' => 2, 'description' => 3, 'language' => 4, 'copyright' => 5, 'link' => 6, 'itunes_author' => 7, 'itunes_keywords' => 8, 'itunes_summary' => 9, 'itunes_subtitle' => 10, 'itunes_category' => 11, 'itunes_explicit' => 12, 'owner' => 13, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + 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, ) ); /** @@ -188,34 +152,10 @@ abstract class BaseStationPodcastPeer extends PodcastPeer { if (null === $alias) { $criteria->addSelectColumn(StationPodcastPeer::ID); - $criteria->addSelectColumn(StationPodcastPeer::TITLE); - $criteria->addSelectColumn(StationPodcastPeer::CREATOR); - $criteria->addSelectColumn(StationPodcastPeer::DESCRIPTION); - $criteria->addSelectColumn(StationPodcastPeer::LANGUAGE); - $criteria->addSelectColumn(StationPodcastPeer::COPYRIGHT); - $criteria->addSelectColumn(StationPodcastPeer::LINK); - $criteria->addSelectColumn(StationPodcastPeer::ITUNES_AUTHOR); - $criteria->addSelectColumn(StationPodcastPeer::ITUNES_KEYWORDS); - $criteria->addSelectColumn(StationPodcastPeer::ITUNES_SUMMARY); - $criteria->addSelectColumn(StationPodcastPeer::ITUNES_SUBTITLE); - $criteria->addSelectColumn(StationPodcastPeer::ITUNES_CATEGORY); - $criteria->addSelectColumn(StationPodcastPeer::ITUNES_EXPLICIT); - $criteria->addSelectColumn(StationPodcastPeer::OWNER); + $criteria->addSelectColumn(StationPodcastPeer::PODCAST_ID); } else { $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.title'); - $criteria->addSelectColumn($alias . '.creator'); - $criteria->addSelectColumn($alias . '.description'); - $criteria->addSelectColumn($alias . '.language'); - $criteria->addSelectColumn($alias . '.copyright'); - $criteria->addSelectColumn($alias . '.link'); - $criteria->addSelectColumn($alias . '.itunes_author'); - $criteria->addSelectColumn($alias . '.itunes_keywords'); - $criteria->addSelectColumn($alias . '.itunes_summary'); - $criteria->addSelectColumn($alias . '.itunes_subtitle'); - $criteria->addSelectColumn($alias . '.itunes_category'); - $criteria->addSelectColumn($alias . '.itunes_explicit'); - $criteria->addSelectColumn($alias . '.owner'); + $criteria->addSelectColumn($alias . '.podcast_id'); } } @@ -553,58 +493,7 @@ abstract class BaseStationPodcastPeer extends PodcastPeer $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); } - $criteria->addJoin(StationPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(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::OWNER, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(StationPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doCount($criteria, $con); @@ -641,7 +530,7 @@ abstract class BaseStationPodcastPeer extends PodcastPeer $startcol = StationPodcastPeer::NUM_HYDRATE_COLUMNS; PodcastPeer::addSelectColumns($criteria); - $criteria->addJoin(StationPodcastPeer::ID, PodcastPeer::ID, $join_behavior); + $criteria->addJoin(StationPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -674,74 +563,6 @@ abstract class BaseStationPodcastPeer extends PodcastPeer } // if obj2 already loaded // Add the $obj1 (StationPodcast) to $obj2 (Podcast) - // one to one relationship - $obj1->setPodcast($obj2); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Selects a collection of StationPodcast objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of StationPodcast objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); - } - - StationPodcastPeer::addSelectColumns($criteria); - $startcol = StationPodcastPeer::NUM_HYDRATE_COLUMNS; - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(StationPodcastPeer::OWNER, CcSubjsPeer::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 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (StationPodcast) to $obj2 (CcSubjs) $obj2->addStationPodcast($obj1); } // if joined row was not null @@ -790,9 +611,7 @@ abstract class BaseStationPodcastPeer extends PodcastPeer $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); } - $criteria->addJoin(StationPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - $criteria->addJoin(StationPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(StationPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doCount($criteria, $con); @@ -831,12 +650,7 @@ abstract class BaseStationPodcastPeer extends PodcastPeer PodcastPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS; - CcSubjsPeer::addSelectColumns($criteria); - $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(StationPodcastPeer::ID, PodcastPeer::ID, $join_behavior); - - $criteria->addJoin(StationPodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(StationPodcastPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -870,276 +684,8 @@ abstract class BaseStationPodcastPeer extends PodcastPeer } // if obj2 loaded // Add the $obj1 (StationPodcast) to the collection in $obj2 (Podcast) - $obj1->setPodcast($obj2); - } // if joined row not null - - // Add objects for joined CcSubjs rows - - $key3 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol3); - if ($key3 !== null) { - $obj3 = CcSubjsPeer::getInstanceFromPool($key3); - if (!$obj3) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj3 = new $cls(); - $obj3->hydrate($row, $startcol3); - CcSubjsPeer::addInstanceToPool($obj3, $key3); - } // if obj3 loaded - - // Add the $obj1 (StationPodcast) to the collection in $obj3 (CcSubjs) - $obj3->addStationPodcast($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining the related Podcast table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAllExceptPodcast(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - StationPodcastPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect 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::OWNER, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - - return $count; - } - - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAllExceptCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - StationPodcastPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect 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::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 except Podcast. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of StationPodcast objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptPodcast(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); - } - - StationPodcastPeer::addSelectColumns($criteria); - $startcol2 = StationPodcastPeer::NUM_HYDRATE_COLUMNS; - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(StationPodcastPeer::OWNER, CcSubjsPeer::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 CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (StationPodcast) to the collection in $obj2 (CcSubjs) $obj2->addStationPodcast($obj1); - - } // if joined row is not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - - return $results; - } - - - /** - * Selects a collection of StationPodcast objects pre-filled with all related objects except CcSubjs. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of StationPodcast objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); - } - - StationPodcastPeer::addSelectColumns($criteria); - $startcol2 = StationPodcastPeer::NUM_HYDRATE_COLUMNS; - - PodcastPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS; - - $criteria->addJoin(StationPodcastPeer::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 already loaded - - // Add the $obj1 (StationPodcast) to the collection in $obj2 (Podcast) - $obj1->setPodcast($obj2); - - } // if joined row is not null + } // if joined row not null $results[] = $obj1; } @@ -1203,6 +749,10 @@ abstract class BaseStationPodcastPeer extends PodcastPeer $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); diff --git a/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php index fcf9aaa38..17851695d 100644 --- a/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php @@ -7,34 +7,10 @@ * * * @method StationPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column - * @method StationPodcastQuery orderByDbTitle($order = Criteria::ASC) Order by the title column - * @method StationPodcastQuery orderByDbCreator($order = Criteria::ASC) Order by the creator column - * @method StationPodcastQuery orderByDbDescription($order = Criteria::ASC) Order by the description column - * @method StationPodcastQuery orderByDbLanguage($order = Criteria::ASC) Order by the language column - * @method StationPodcastQuery orderByDbCopyright($order = Criteria::ASC) Order by the copyright column - * @method StationPodcastQuery orderByDbLink($order = Criteria::ASC) Order by the link column - * @method StationPodcastQuery orderByDbItunesAuthor($order = Criteria::ASC) Order by the itunes_author column - * @method StationPodcastQuery orderByDbItunesKeywords($order = Criteria::ASC) Order by the itunes_keywords column - * @method StationPodcastQuery orderByDbItunesSummary($order = Criteria::ASC) Order by the itunes_summary column - * @method StationPodcastQuery orderByDbItunesSubtitle($order = Criteria::ASC) Order by the itunes_subtitle column - * @method StationPodcastQuery orderByDbItunesCategory($order = Criteria::ASC) Order by the itunes_category column - * @method StationPodcastQuery orderByDbItunesExplicit($order = Criteria::ASC) Order by the itunes_explicit column - * @method StationPodcastQuery orderByDbOwner($order = Criteria::ASC) Order by the owner column + * @method StationPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column * * @method StationPodcastQuery groupByDbId() Group by the id column - * @method StationPodcastQuery groupByDbTitle() Group by the title column - * @method StationPodcastQuery groupByDbCreator() Group by the creator column - * @method StationPodcastQuery groupByDbDescription() Group by the description column - * @method StationPodcastQuery groupByDbLanguage() Group by the language column - * @method StationPodcastQuery groupByDbCopyright() Group by the copyright column - * @method StationPodcastQuery groupByDbLink() Group by the link column - * @method StationPodcastQuery groupByDbItunesAuthor() Group by the itunes_author column - * @method StationPodcastQuery groupByDbItunesKeywords() Group by the itunes_keywords column - * @method StationPodcastQuery groupByDbItunesSummary() Group by the itunes_summary column - * @method StationPodcastQuery groupByDbItunesSubtitle() Group by the itunes_subtitle column - * @method StationPodcastQuery groupByDbItunesCategory() Group by the itunes_category column - * @method StationPodcastQuery groupByDbItunesExplicit() Group by the itunes_explicit column - * @method StationPodcastQuery groupByDbOwner() Group by the owner 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 @@ -44,45 +20,17 @@ * @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 StationPodcastQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation - * @method StationPodcastQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation - * @method StationPodcastQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs 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 findOneByDbTitle(string $title) Return the first StationPodcast filtered by the title column - * @method StationPodcast findOneByDbCreator(string $creator) Return the first StationPodcast filtered by the creator column - * @method StationPodcast findOneByDbDescription(string $description) Return the first StationPodcast filtered by the description column - * @method StationPodcast findOneByDbLanguage(string $language) Return the first StationPodcast filtered by the language column - * @method StationPodcast findOneByDbCopyright(string $copyright) Return the first StationPodcast filtered by the copyright column - * @method StationPodcast findOneByDbLink(string $link) Return the first StationPodcast filtered by the link column - * @method StationPodcast findOneByDbItunesAuthor(string $itunes_author) Return the first StationPodcast filtered by the itunes_author column - * @method StationPodcast findOneByDbItunesKeywords(string $itunes_keywords) Return the first StationPodcast filtered by the itunes_keywords column - * @method StationPodcast findOneByDbItunesSummary(string $itunes_summary) Return the first StationPodcast filtered by the itunes_summary column - * @method StationPodcast findOneByDbItunesSubtitle(string $itunes_subtitle) Return the first StationPodcast filtered by the itunes_subtitle column - * @method StationPodcast findOneByDbItunesCategory(string $itunes_category) Return the first StationPodcast filtered by the itunes_category column - * @method StationPodcast findOneByDbItunesExplicit(string $itunes_explicit) Return the first StationPodcast filtered by the itunes_explicit column - * @method StationPodcast findOneByDbOwner(int $owner) Return the first StationPodcast filtered by the owner column + * @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 findByDbTitle(string $title) Return StationPodcast objects filtered by the title column - * @method array findByDbCreator(string $creator) Return StationPodcast objects filtered by the creator column - * @method array findByDbDescription(string $description) Return StationPodcast objects filtered by the description column - * @method array findByDbLanguage(string $language) Return StationPodcast objects filtered by the language column - * @method array findByDbCopyright(string $copyright) Return StationPodcast objects filtered by the copyright column - * @method array findByDbLink(string $link) Return StationPodcast objects filtered by the link column - * @method array findByDbItunesAuthor(string $itunes_author) Return StationPodcast objects filtered by the itunes_author column - * @method array findByDbItunesKeywords(string $itunes_keywords) Return StationPodcast objects filtered by the itunes_keywords column - * @method array findByDbItunesSummary(string $itunes_summary) Return StationPodcast objects filtered by the itunes_summary column - * @method array findByDbItunesSubtitle(string $itunes_subtitle) Return StationPodcast objects filtered by the itunes_subtitle column - * @method array findByDbItunesCategory(string $itunes_category) Return StationPodcast objects filtered by the itunes_category column - * @method array findByDbItunesExplicit(string $itunes_explicit) Return StationPodcast objects filtered by the itunes_explicit column - * @method array findByDbOwner(int $owner) Return StationPodcast objects filtered by the owner 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 PodcastQuery +abstract class BaseStationPodcastQuery extends ModelCriteria { /** * Initializes internal state of BaseStationPodcastQuery object. @@ -186,7 +134,7 @@ abstract class BaseStationPodcastQuery extends PodcastQuery */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "title", "creator", "description", "language", "copyright", "link", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "owner" FROM "station_podcast" WHERE "id" = :p0'; + $sql = 'SELECT "id", "podcast_id" FROM "station_podcast" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -286,8 +234,6 @@ abstract class BaseStationPodcastQuery extends PodcastQuery * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12 * * - * @see filterByPodcast() - * * @param mixed $dbId The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. @@ -320,367 +266,19 @@ abstract class BaseStationPodcastQuery extends PodcastQuery } /** - * Filter the query on the title column + * Filter the query on the podcast_id column * * Example usage: * - * $query->filterByDbTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByDbTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' + * $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 * * - * @param string $dbTitle The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * @see filterByPodcast() * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbTitle($dbTitle = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbTitle)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbTitle)) { - $dbTitle = str_replace('*', '%', $dbTitle); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::TITLE, $dbTitle, $comparison); - } - - /** - * Filter the query on the creator column - * - * Example usage: - * - * $query->filterByDbCreator('fooValue'); // WHERE creator = 'fooValue' - * $query->filterByDbCreator('%fooValue%'); // WHERE creator LIKE '%fooValue%' - * - * - * @param string $dbCreator The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbCreator($dbCreator = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbCreator)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbCreator)) { - $dbCreator = str_replace('*', '%', $dbCreator); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::CREATOR, $dbCreator, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $dbDescription The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery 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(StationPodcastPeer::DESCRIPTION, $dbDescription, $comparison); - } - - /** - * Filter the query on the language column - * - * Example usage: - * - * $query->filterByDbLanguage('fooValue'); // WHERE language = 'fooValue' - * $query->filterByDbLanguage('%fooValue%'); // WHERE language LIKE '%fooValue%' - * - * - * @param string $dbLanguage The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbLanguage($dbLanguage = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbLanguage)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbLanguage)) { - $dbLanguage = str_replace('*', '%', $dbLanguage); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::LANGUAGE, $dbLanguage, $comparison); - } - - /** - * Filter the query on the copyright column - * - * Example usage: - * - * $query->filterByDbCopyright('fooValue'); // WHERE copyright = 'fooValue' - * $query->filterByDbCopyright('%fooValue%'); // WHERE copyright LIKE '%fooValue%' - * - * - * @param string $dbCopyright The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbCopyright($dbCopyright = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbCopyright)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbCopyright)) { - $dbCopyright = str_replace('*', '%', $dbCopyright); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::COPYRIGHT, $dbCopyright, $comparison); - } - - /** - * Filter the query on the link column - * - * Example usage: - * - * $query->filterByDbLink('fooValue'); // WHERE link = 'fooValue' - * $query->filterByDbLink('%fooValue%'); // WHERE link LIKE '%fooValue%' - * - * - * @param string $dbLink The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbLink($dbLink = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbLink)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbLink)) { - $dbLink = str_replace('*', '%', $dbLink); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::LINK, $dbLink, $comparison); - } - - /** - * Filter the query on the itunes_author column - * - * Example usage: - * - * $query->filterByDbItunesAuthor('fooValue'); // WHERE itunes_author = 'fooValue' - * $query->filterByDbItunesAuthor('%fooValue%'); // WHERE itunes_author LIKE '%fooValue%' - * - * - * @param string $dbItunesAuthor The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesAuthor($dbItunesAuthor = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesAuthor)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesAuthor)) { - $dbItunesAuthor = str_replace('*', '%', $dbItunesAuthor); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::ITUNES_AUTHOR, $dbItunesAuthor, $comparison); - } - - /** - * Filter the query on the itunes_keywords column - * - * Example usage: - * - * $query->filterByDbItunesKeywords('fooValue'); // WHERE itunes_keywords = 'fooValue' - * $query->filterByDbItunesKeywords('%fooValue%'); // WHERE itunes_keywords LIKE '%fooValue%' - * - * - * @param string $dbItunesKeywords The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesKeywords($dbItunesKeywords = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesKeywords)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesKeywords)) { - $dbItunesKeywords = str_replace('*', '%', $dbItunesKeywords); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::ITUNES_KEYWORDS, $dbItunesKeywords, $comparison); - } - - /** - * Filter the query on the itunes_summary column - * - * Example usage: - * - * $query->filterByDbItunesSummary('fooValue'); // WHERE itunes_summary = 'fooValue' - * $query->filterByDbItunesSummary('%fooValue%'); // WHERE itunes_summary LIKE '%fooValue%' - * - * - * @param string $dbItunesSummary The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesSummary($dbItunesSummary = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesSummary)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesSummary)) { - $dbItunesSummary = str_replace('*', '%', $dbItunesSummary); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::ITUNES_SUMMARY, $dbItunesSummary, $comparison); - } - - /** - * Filter the query on the itunes_subtitle column - * - * Example usage: - * - * $query->filterByDbItunesSubtitle('fooValue'); // WHERE itunes_subtitle = 'fooValue' - * $query->filterByDbItunesSubtitle('%fooValue%'); // WHERE itunes_subtitle LIKE '%fooValue%' - * - * - * @param string $dbItunesSubtitle The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesSubtitle($dbItunesSubtitle = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesSubtitle)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesSubtitle)) { - $dbItunesSubtitle = str_replace('*', '%', $dbItunesSubtitle); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::ITUNES_SUBTITLE, $dbItunesSubtitle, $comparison); - } - - /** - * Filter the query on the itunes_category column - * - * Example usage: - * - * $query->filterByDbItunesCategory('fooValue'); // WHERE itunes_category = 'fooValue' - * $query->filterByDbItunesCategory('%fooValue%'); // WHERE itunes_category LIKE '%fooValue%' - * - * - * @param string $dbItunesCategory The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesCategory($dbItunesCategory = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesCategory)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesCategory)) { - $dbItunesCategory = str_replace('*', '%', $dbItunesCategory); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::ITUNES_CATEGORY, $dbItunesCategory, $comparison); - } - - /** - * Filter the query on the itunes_explicit column - * - * Example usage: - * - * $query->filterByDbItunesExplicit('fooValue'); // WHERE itunes_explicit = 'fooValue' - * $query->filterByDbItunesExplicit('%fooValue%'); // WHERE itunes_explicit LIKE '%fooValue%' - * - * - * @param string $dbItunesExplicit The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function filterByDbItunesExplicit($dbItunesExplicit = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbItunesExplicit)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbItunesExplicit)) { - $dbItunesExplicit = str_replace('*', '%', $dbItunesExplicit); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(StationPodcastPeer::ITUNES_EXPLICIT, $dbItunesExplicit, $comparison); - } - - /** - * Filter the query on the owner column - * - * Example usage: - * - * $query->filterByDbOwner(1234); // WHERE owner = 1234 - * $query->filterByDbOwner(array(12, 34)); // WHERE owner IN (12, 34) - * $query->filterByDbOwner(array('min' => 12)); // WHERE owner >= 12 - * $query->filterByDbOwner(array('max' => 12)); // WHERE owner <= 12 - * - * - * @see filterByCcSubjs() - * - * @param mixed $dbOwner The value to use as filter. + * @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. @@ -688,16 +286,16 @@ abstract class BaseStationPodcastQuery extends PodcastQuery * * @return StationPodcastQuery The current query, for fluid interface */ - public function filterByDbOwner($dbOwner = null, $comparison = null) + public function filterByDbPodcastId($dbPodcastId = null, $comparison = null) { - if (is_array($dbOwner)) { + if (is_array($dbPodcastId)) { $useMinMax = false; - if (isset($dbOwner['min'])) { - $this->addUsingAlias(StationPodcastPeer::OWNER, $dbOwner['min'], Criteria::GREATER_EQUAL); + if (isset($dbPodcastId['min'])) { + $this->addUsingAlias(StationPodcastPeer::PODCAST_ID, $dbPodcastId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($dbOwner['max'])) { - $this->addUsingAlias(StationPodcastPeer::OWNER, $dbOwner['max'], Criteria::LESS_EQUAL); + if (isset($dbPodcastId['max'])) { + $this->addUsingAlias(StationPodcastPeer::PODCAST_ID, $dbPodcastId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -708,7 +306,7 @@ abstract class BaseStationPodcastQuery extends PodcastQuery } } - return $this->addUsingAlias(StationPodcastPeer::OWNER, $dbOwner, $comparison); + return $this->addUsingAlias(StationPodcastPeer::PODCAST_ID, $dbPodcastId, $comparison); } /** @@ -724,14 +322,14 @@ abstract class BaseStationPodcastQuery extends PodcastQuery { if ($podcast instanceof Podcast) { return $this - ->addUsingAlias(StationPodcastPeer::ID, $podcast->getDbId(), $comparison); + ->addUsingAlias(StationPodcastPeer::PODCAST_ID, $podcast->getDbId(), $comparison); } elseif ($podcast instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(StationPodcastPeer::ID, $podcast->toKeyValue('PrimaryKey', 'DbId'), $comparison); + ->addUsingAlias(StationPodcastPeer::PODCAST_ID, $podcast->toKeyValue('PrimaryKey', 'DbId'), $comparison); } else { throw new PropelException('filterByPodcast() only accepts arguments of type Podcast or PropelCollection'); } @@ -787,82 +385,6 @@ abstract class BaseStationPodcastQuery extends PodcastQuery ->useQuery($relationAlias ? $relationAlias : 'Podcast', 'PodcastQuery'); } - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return StationPodcastQuery The current query, for fluid interface - * @throws PropelException - if the provided filter is invalid. - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - if ($ccSubjs instanceof CcSubjs) { - return $this - ->addUsingAlias(StationPodcastPeer::OWNER, $ccSubjs->getDbId(), $comparison); - } elseif ($ccSubjs instanceof PropelObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(StationPodcastPeer::OWNER, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison); - } else { - throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection'); - } - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return StationPodcastQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - /** * Exclude object from result * diff --git a/airtime_mvc/application/modules/rest/controllers/PodcastController.php b/airtime_mvc/application/modules/rest/controllers/PodcastController.php index 46e0b37f1..54e34f7ce 100644 --- a/airtime_mvc/application/modules/rest/controllers/PodcastController.php +++ b/airtime_mvc/application/modules/rest/controllers/PodcastController.php @@ -1,5 +1,7 @@ _helper->viewRenderer->setNoRender(true); $this->view->setScriptPath(APPLICATION_PATH . 'views/scripts/'); - $this->_service = new Application_Service_PodcastService(); + $this->_service = new Application_Service_PodcastEpisodeService(); } public function indexAction() @@ -83,7 +85,7 @@ class Rest_PodcastController extends Zend_Rest_Controller try { //$requestData = json_decode($this->getRequest()->getRawBody(), true); $requestData = $this->getRequest()->getPost(); - $podcast = Podcast::create($requestData); + $podcast = PodcastFactory::create($requestData["url"]); $path = 'podcast/podcast.phtml'; $this->view->podcast = $podcast; @@ -94,10 +96,6 @@ class Rest_PodcastController extends Zend_Rest_Controller "id"=>$podcast["id"] // "id"=>$podcast->getDbId() )); - - // $this->getResponse() - // ->setHttpResponseCode(201) - // ->appendBody(json_encode($podcast)); } catch (PodcastLimitReachedException $e) { $this->getResponse() diff --git a/airtime_mvc/application/services/CeleryServiceFactory.php b/airtime_mvc/application/services/CeleryServiceFactory.php index 5dc577cd4..e92b1ef8c 100644 --- a/airtime_mvc/application/services/CeleryServiceFactory.php +++ b/airtime_mvc/application/services/CeleryServiceFactory.php @@ -14,7 +14,7 @@ class CeleryServiceFactory { case SOUNDCLOUD_SERVICE_NAME: return new Application_Service_SoundcloudService(); case PODCAST_SERVICE_NAME: - return new Application_Service_PodcastService(); + return new Application_Service_PodcastEpisodeService(); default: return null; } diff --git a/airtime_mvc/application/services/ImportedPodcastService.php b/airtime_mvc/application/services/ImportedPodcastService.php new file mode 100644 index 000000000..f0e8532cb --- /dev/null +++ b/airtime_mvc/application/services/ImportedPodcastService.php @@ -0,0 +1,215 @@ +count() >= 50) { + return true; + } else { + return false; + } + } + + /** + * Returns parsed rss feed, or false if the given URL cannot be downloaded + * + * @param $podcastUrl String containing the podcast feed URL + * + * @return mixed + */ + public static function getPodcastFeed($feedUrl) + { + try { + $feed = new SimplePie(); + $feed->set_feed_url($feedUrl); + $feed->enable_cache(false); + $feed->init(); + return $feed; + } catch (Exception $e) { + return false; + } + } + + /** Creates a Podcast object from the given podcast URL. + * This is used by our Podcast REST API + * + * @param $feedUrl Podcast RSS Feed Url + * + * @return array - Podcast Array with a full list of episodes + * @throws Exception + * @throws InvalidPodcastException + * @throws PodcastLimitReachedException + */ + public static function createFromFeedUrl($feedUrl) + { + if (self::importedPodcastLimitReached()) { + throw new PodcastLimitReachedException(); + } + + //TODO: why is this so slow? + $rss = self::getPodcastFeed($feedUrl); + 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"] = $feedUrl; + + $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(); + + //TODO: put in constants + $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 { + // Base class + $podcast = new Podcast(); + $podcast->fromArray($podcastArray, BasePeer::TYPE_FIELDNAME); + $podcast->setDbOwner(self::getOwnerId()); + $podcast->save(); + + $importedPodcast = new ImportedPodcast(); + $importedPodcast->fromArray($podcastArray, BasePeer::TYPE_FIELDNAME); + $importedPodcast->setPodcast($podcast); + $importedPodcast->save(); + + return self::_generatePodcastArray($importedPodcast, $rss); + } catch(Exception $e) { + $podcast->delete(); + throw $e; + } + } + + //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()); + } + } + + /** + * 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()); + } + } + } + + /** + * Given a podcast object and a SimplePie feed object, + * generate a data array to pass back to the front-end + * + * @param $importedPodcast ImportedPodcast model object + * @param SimplePie $rss SimplePie feed object + * + * @return array + */ + private static function _generatePodcastArray($importedPodcast, $rss) { + $podcastArray = $importedPodcast->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; + } +} \ No newline at end of file diff --git a/airtime_mvc/application/services/PodcastService.php b/airtime_mvc/application/services/PodcastEpisodeService.php similarity index 88% rename from airtime_mvc/application/services/PodcastService.php rename to airtime_mvc/application/services/PodcastEpisodeService.php index 9ff9b340b..3a76c1c11 100644 --- a/airtime_mvc/application/services/PodcastService.php +++ b/airtime_mvc/application/services/PodcastEpisodeService.php @@ -1,6 +1,6 @@ 'podcast-download' // TODO: rename this to ingest? ]; - /** - * There is maximum of 50 podcasts allowed in the library - to limit - * resource consumption. This function returns true if the podcast - * limit has been reached. - * - * @return bool - */ - public static function podcastLimitReached() - { - if (PodcastQuery::create()->count() >= 50) { - return true; - } else { - return false; - } - } - - /** - * Returns parsed rss feed, or false if the given URL cannot be downloaded - * - * @param $podcastUrl String containing the podcast feed URL - * - * @return mixed - */ - public static function getPodcastFeed($podcastUrl) - { - try { - $feed = new SimplePie(); - $feed->set_feed_url($podcastUrl); - $feed->enable_cache(false); - $feed->init(); - return $feed; - } catch (Exception $e) { - return false; - } - } - public static function createStationRssFeed() { //TODO: get station feed podcast ID diff --git a/airtime_mvc/application/services/PodcastFactory.php b/airtime_mvc/application/services/PodcastFactory.php new file mode 100644 index 000000000..d3ad3f4dd --- /dev/null +++ b/airtime_mvc/application/services/PodcastFactory.php @@ -0,0 +1,11 @@ + - +
@@ -584,16 +584,26 @@
- - + + + + + + +
+ - - + + + + + +
diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index 18772939c..96c4d2d95 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -729,7 +729,6 @@ CREATE TABLE "podcast" "itunes_category" VARCHAR(4096), "itunes_explicit" VARCHAR(4096), "owner" INTEGER, - "descendant_class" VARCHAR(100), PRIMARY KEY ("id") ); @@ -741,20 +740,8 @@ DROP TABLE IF EXISTS "station_podcast" CASCADE; CREATE TABLE "station_podcast" ( - "id" INTEGER 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, + "id" serial NOT NULL, + "podcast_id" INTEGER NOT NULL, PRIMARY KEY ("id") ); @@ -766,22 +753,10 @@ DROP TABLE IF EXISTS "imported_podcast" CASCADE; CREATE TABLE "imported_podcast" ( + "id" serial NOT NULL, "url" VARCHAR(4096) NOT NULL, "auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL, - "id" INTEGER 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, + "podcast_id" INTEGER NOT NULL, PRIMARY KEY ("id") ); @@ -979,26 +954,16 @@ ALTER TABLE "podcast" ADD CONSTRAINT "podcast_owner_fkey" REFERENCES "cc_subjs" ("id") ON DELETE CASCADE; -ALTER TABLE "station_podcast" ADD CONSTRAINT "station_podcast_FK_1" - FOREIGN KEY ("id") +ALTER TABLE "station_podcast" ADD CONSTRAINT "podcast_id_fkey" + FOREIGN KEY ("podcast_id") REFERENCES "podcast" ("id") ON DELETE CASCADE; -ALTER TABLE "station_podcast" ADD CONSTRAINT "station_podcast_FK_2" - FOREIGN KEY ("owner") - REFERENCES "cc_subjs" ("id") - ON DELETE CASCADE; - -ALTER TABLE "imported_podcast" ADD CONSTRAINT "imported_podcast_FK_1" - FOREIGN KEY ("id") +ALTER TABLE "imported_podcast" ADD CONSTRAINT "podcast_id_fkey" + FOREIGN KEY ("podcast_id") REFERENCES "podcast" ("id") ON DELETE CASCADE; -ALTER TABLE "imported_podcast" ADD CONSTRAINT "imported_podcast_FK_2" - FOREIGN KEY ("owner") - REFERENCES "cc_subjs" ("id") - ON DELETE CASCADE; - ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_cc_files_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id")