From b00ac6750cd602b361c1c46c2965cc168ffeb3e8 Mon Sep 17 00:00:00 2001 From: drigato Date: Tue, 29 Sep 2015 13:04:22 -0400 Subject: [PATCH] Testing --- airtime_mvc/application/configs/ACL.php | 5 +- .../configs/classmap-airtime-conf.php | 14 + airtime_mvc/application/configs/constants.php | 6 +- .../controllers/FeedsController.php | 14 + .../controllers/plugins/Acl_plugin.php | 3 +- .../models/airtime/ImportedPodcast.php | 18 + .../models/airtime/ImportedPodcastPeer.php | 18 + .../models/airtime/ImportedPodcastQuery.php | 18 + .../models/airtime/StationPodcast.php | 18 + .../models/airtime/StationPodcastPeer.php | 18 + .../models/airtime/StationPodcastQuery.php | 18 + .../models/airtime/map/CcSubjsTableMap.php | 2 + .../airtime/map/ImportedPodcastTableMap.php | 88 + .../models/airtime/map/PodcastTableMap.php | 22 +- .../airtime/map/StationPodcastTableMap.php | 86 + .../models/airtime/om/BaseCcSubjs.php | 620 ++++++ .../models/airtime/om/BaseCcSubjsPeer.php | 6 + .../models/airtime/om/BaseCcSubjsQuery.php | 156 ++ .../models/airtime/om/BaseImportedPodcast.php | 1898 +++++++++++++++++ .../airtime/om/BaseImportedPodcastPeer.php | 1459 +++++++++++++ .../airtime/om/BaseImportedPodcastQuery.php | 946 ++++++++ .../models/airtime/om/BasePodcast.php | 489 +++-- .../models/airtime/om/BasePodcastPeer.php | 73 +- .../models/airtime/om/BasePodcastQuery.php | 300 ++- .../models/airtime/om/BaseStationPodcast.php | 1751 +++++++++++++++ .../airtime/om/BaseStationPodcastPeer.php | 1449 +++++++++++++ .../airtime/om/BaseStationPodcastQuery.php | 882 ++++++++ .../rest/controllers/PodcastController.php | 2 +- .../controllers/PodcastEpisodesController.php | 6 +- .../application/services/PodcastService.php | 94 +- airtime_mvc/build/schema.xml | 20 +- airtime_mvc/build/sql/schema.sql | 77 +- 32 files changed, 10218 insertions(+), 358 deletions(-) create mode 100644 airtime_mvc/application/controllers/FeedsController.php create mode 100644 airtime_mvc/application/models/airtime/ImportedPodcast.php create mode 100644 airtime_mvc/application/models/airtime/ImportedPodcastPeer.php create mode 100644 airtime_mvc/application/models/airtime/ImportedPodcastQuery.php create mode 100644 airtime_mvc/application/models/airtime/StationPodcast.php create mode 100644 airtime_mvc/application/models/airtime/StationPodcastPeer.php create mode 100644 airtime_mvc/application/models/airtime/StationPodcastQuery.php create mode 100644 airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php create mode 100644 airtime_mvc/application/models/airtime/map/StationPodcastTableMap.php create mode 100644 airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php create mode 100644 airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php create mode 100644 airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php create mode 100644 airtime_mvc/application/models/airtime/om/BaseStationPodcast.php create mode 100644 airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php create mode 100644 airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index 91fee1194..74be31809 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -44,7 +44,8 @@ $ccAcl->add(new Zend_Acl_Resource('library')) ->add(new Zend_Acl_Resource('render')) ->add(new Zend_Acl_Resource('soundcloud')) ->add(new Zend_Acl_Resource('embeddablewidgets')) - ->add(new Zend_Acl_Resource('setup')); + ->add(new Zend_Acl_Resource('setup')) + ->add(new Zend_Acl_Resource('feeds')); /** Creating permissions */ $ccAcl->allow('G', 'index') @@ -65,11 +66,11 @@ $ccAcl->allow('G', 'index') ->allow('G', 'downgrade') ->allow('G', 'rest:show-image', 'get') ->allow('G', 'rest:media', 'get') -// ->allow('G', 'rest:podcast', 'index') ->allow('G', 'rest:podcast', 'get') ->allow('G', 'rest:podcast-episodes', 'get') ->allow('G', 'setup') ->allow('G', 'embeddablewidgets') + ->allow('G', 'feeds') ->allow('H', 'soundcloud') ->allow('H', 'rest:show-image') ->allow('H', 'rest:media') diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php index 7dbf7597d..4eb58b161 100644 --- a/airtime_mvc/application/configs/classmap-airtime-conf.php +++ b/airtime_mvc/application/configs/classmap-airtime-conf.php @@ -106,12 +106,18 @@ return array ( 'BaseCloudFile' => 'airtime/om/BaseCloudFile.php', 'BaseCloudFilePeer' => 'airtime/om/BaseCloudFilePeer.php', 'BaseCloudFileQuery' => 'airtime/om/BaseCloudFileQuery.php', + 'BaseImportedPodcast' => 'airtime/om/BaseImportedPodcast.php', + 'BaseImportedPodcastPeer' => 'airtime/om/BaseImportedPodcastPeer.php', + 'BaseImportedPodcastQuery' => 'airtime/om/BaseImportedPodcastQuery.php', 'BasePodcast' => 'airtime/om/BasePodcast.php', 'BasePodcastEpisodes' => 'airtime/om/BasePodcastEpisodes.php', 'BasePodcastEpisodesPeer' => 'airtime/om/BasePodcastEpisodesPeer.php', 'BasePodcastEpisodesQuery' => 'airtime/om/BasePodcastEpisodesQuery.php', 'BasePodcastPeer' => 'airtime/om/BasePodcastPeer.php', 'BasePodcastQuery' => 'airtime/om/BasePodcastQuery.php', + 'BaseStationPodcast' => 'airtime/om/BaseStationPodcast.php', + 'BaseStationPodcastPeer' => 'airtime/om/BaseStationPodcastPeer.php', + 'BaseStationPodcastQuery' => 'airtime/om/BaseStationPodcastQuery.php', 'BaseThirdPartyTrackReferences' => 'airtime/om/BaseThirdPartyTrackReferences.php', 'BaseThirdPartyTrackReferencesPeer' => 'airtime/om/BaseThirdPartyTrackReferencesPeer.php', 'BaseThirdPartyTrackReferencesQuery' => 'airtime/om/BaseThirdPartyTrackReferencesQuery.php', @@ -255,6 +261,10 @@ return array ( 'CloudFilePeer' => 'airtime/CloudFilePeer.php', 'CloudFileQuery' => 'airtime/CloudFileQuery.php', 'CloudFileTableMap' => 'airtime/map/CloudFileTableMap.php', + 'ImportedPodcast' => 'airtime/ImportedPodcast.php', + 'ImportedPodcastPeer' => 'airtime/ImportedPodcastPeer.php', + 'ImportedPodcastQuery' => 'airtime/ImportedPodcastQuery.php', + 'ImportedPodcastTableMap' => 'airtime/map/ImportedPodcastTableMap.php', 'Podcast' => 'airtime/Podcast.php', 'PodcastEpisodes' => 'airtime/PodcastEpisodes.php', 'PodcastEpisodesPeer' => 'airtime/PodcastEpisodesPeer.php', @@ -263,6 +273,10 @@ return array ( 'PodcastPeer' => 'airtime/PodcastPeer.php', 'PodcastQuery' => 'airtime/PodcastQuery.php', 'PodcastTableMap' => 'airtime/map/PodcastTableMap.php', + 'StationPodcast' => 'airtime/StationPodcast.php', + 'StationPodcastPeer' => 'airtime/StationPodcastPeer.php', + 'StationPodcastQuery' => 'airtime/StationPodcastQuery.php', + 'StationPodcastTableMap' => 'airtime/map/StationPodcastTableMap.php', 'ThirdPartyTrackReferences' => 'airtime/ThirdPartyTrackReferences.php', 'ThirdPartyTrackReferencesPeer' => 'airtime/ThirdPartyTrackReferencesPeer.php', 'ThirdPartyTrackReferencesQuery' => 'airtime/ThirdPartyTrackReferencesQuery.php', diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index efb0935d3..c87fbc3f9 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -124,5 +124,7 @@ define('SOUNDCLOUD_SERVICE_NAME', 'soundcloud'); define('PODCAST_SERVICE_NAME', 'podcast'); // Podcast Types -define('STATION_PODCAST', 0); -define('IMPORTED_PODCAST', 1); +//define('STATION_PODCAST', 0); +//define('IMPORTED_PODCAST', 1); + +define('ITUNES_XML_NAMESPACE_URL', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); diff --git a/airtime_mvc/application/controllers/FeedsController.php b/airtime_mvc/application/controllers/FeedsController.php new file mode 100644 index 000000000..9a583275a --- /dev/null +++ b/airtime_mvc/application/controllers/FeedsController.php @@ -0,0 +1,14 @@ +view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + header('Content-Type: text/xml'); + + echo Application_Service_PodcastService::createStationRssFeed(); + } +} \ No newline at end of file diff --git a/airtime_mvc/application/controllers/plugins/Acl_plugin.php b/airtime_mvc/application/controllers/plugins/Acl_plugin.php index 923b2cf05..f9bcdd55d 100644 --- a/airtime_mvc/application/controllers/plugins/Acl_plugin.php +++ b/airtime_mvc/application/controllers/plugins/Acl_plugin.php @@ -119,7 +119,8 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract "upgrade", 'whmcs-login', "provisioning", - "embed" + "embed", + "feeds" ))) { $this->setRoleName("G"); diff --git a/airtime_mvc/application/models/airtime/ImportedPodcast.php b/airtime_mvc/application/models/airtime/ImportedPodcast.php new file mode 100644 index 000000000..1ddb4a66b --- /dev/null +++ b/airtime_mvc/application/models/airtime/ImportedPodcast.php @@ -0,0 +1,18 @@ +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 new file mode 100644 index 000000000..e89c1aa01 --- /dev/null +++ b/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php @@ -0,0 +1,88 @@ +setName('imported_podcast'); + $this->setPhpName('ImportedPodcast'); + $this->setClassname('ImportedPodcast'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $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); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + 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); + } // 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' => array ( + 'extends' => 'podcast', + 'descendant_column' => 'descendant_class', + 'copy_data_to_parent' => 'true', + 'schema' => '', + 'excluded_parent_behavior' => 'nested_set', +), + ); + } // getBehaviors() + +} // ImportedPodcastTableMap diff --git a/airtime_mvc/application/models/airtime/map/PodcastTableMap.php b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php index 74ea4a29a..640f2204c 100644 --- a/airtime_mvc/application/models/airtime/map/PodcastTableMap.php +++ b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php @@ -40,21 +40,20 @@ class PodcastTableMap extends TableMap $this->setPrimaryKeyMethodInfo('podcast_id_seq'); // columns $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); - $this->addColumn('url', 'DbUrl', 'VARCHAR', true, 4096, null); $this->addColumn('title', 'DbTitle', 'VARCHAR', true, 4096, null); $this->addColumn('creator', 'DbCreator', 'VARCHAR', false, 4096, null); $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 4096, null); $this->addColumn('language', 'DbLanguage', 'VARCHAR', false, 4096, null); $this->addColumn('copyright', 'DbCopyright', 'VARCHAR', false, 4096, null); + $this->addColumn('link', 'DbLink', 'VARCHAR', false, 4096, null); $this->addColumn('itunes_author', 'DbItunesAuthor', 'VARCHAR', false, 4096, null); $this->addColumn('itunes_keywords', 'DbItunesKeywords', 'VARCHAR', false, 4096, null); $this->addColumn('itunes_summary', 'DbItunesSummary', 'VARCHAR', false, 4096, null); $this->addColumn('itunes_subtitle', 'DbItunesSubtitle', 'VARCHAR', false, 4096, null); $this->addColumn('itunes_category', 'DbItunesCategory', 'VARCHAR', false, 4096, null); $this->addColumn('itunes_explicit', 'DbItunesExplicit', 'VARCHAR', false, 4096, null); - $this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false); $this->addForeignKey('owner', 'DbOwner', 'INTEGER', 'cc_subjs', 'id', false, null, null); - $this->addColumn('type', 'DbType', 'INTEGER', true, null, 1); + $this->addColumn('descendant_class', 'DescendantClass', 'VARCHAR', false, 100, null); // validators } // initialize() @@ -65,6 +64,23 @@ class PodcastTableMap extends TableMap { $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), 'CASCADE', null); $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 new file mode 100644 index 000000000..45c73f887 --- /dev/null +++ b/airtime_mvc/application/models/airtime/map/StationPodcastTableMap.php @@ -0,0 +1,86 @@ +setName('station_podcast'); + $this->setPhpName('StationPodcast'); + $this->setClassname('StationPodcast'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // 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); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + 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); + } // 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' => array ( + 'extends' => 'podcast', + 'descendant_column' => 'descendant_class', + 'copy_data_to_parent' => 'true', + 'schema' => '', + 'excluded_parent_behavior' => 'nested_set', +), + ); + } // getBehaviors() + +} // StationPodcastTableMap diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php index 1368aafa5..02fb9ae8d 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php @@ -173,6 +173,18 @@ 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. @@ -253,6 +265,18 @@ 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 @@ -907,6 +931,10 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->collPodcasts = null; + $this->collStationPodcasts = null; + + $this->collImportedPodcasts = null; + } // if (deep) } @@ -1203,6 +1231,40 @@ 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; } @@ -1500,6 +1562,22 @@ 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; } @@ -1653,6 +1731,12 @@ 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; @@ -1930,6 +2014,18 @@ 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) @@ -2021,6 +2117,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if ('Podcast' == $relationName) { $this->initPodcasts(); } + if ('StationPodcast' == $relationName) { + $this->initStationPodcasts(); + } + if ('ImportedPodcast' == $relationName) { + $this->initImportedPodcasts(); + } } /** @@ -4348,6 +4450,506 @@ 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 */ @@ -4439,6 +5041,16 @@ 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) @@ -4483,6 +5095,14 @@ 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 2f3d3b502..03823587d 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php @@ -439,6 +439,12 @@ 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 11fab88b1..af9a68404 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php @@ -78,6 +78,14 @@ * @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 * @@ -1474,6 +1482,154 @@ 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 new file mode 100644 index 000000000..7eec9a1a1 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php @@ -0,0 +1,1898 @@ +auto_ingest = false; + } + + /** + * Initializes internal state of BaseImportedPodcast object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [url] column value. + * + * @return string + */ + public function getDbUrl() + { + + return $this->url; + } + + /** + * Get the [auto_ingest] column value. + * + * @return boolean + */ + public function getDbAutoIngest() + { + + return $this->auto_ingest; + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + + return $this->id; + } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getDbTitle() + { + + return $this->title; + } + + /** + * Get the [creator] column value. + * + * @return string + */ + public function getDbCreator() + { + + return $this->creator; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDbDescription() + { + + return $this->description; + } + + /** + * Get the [language] column value. + * + * @return string + */ + public function getDbLanguage() + { + + return $this->language; + } + + /** + * Get the [copyright] column value. + * + * @return string + */ + public function getDbCopyright() + { + + return $this->copyright; + } + + /** + * Get the [link] column value. + * + * @return string + */ + public function getDbLink() + { + + return $this->link; + } + + /** + * Get the [itunes_author] column value. + * + * @return string + */ + public function getDbItunesAuthor() + { + + return $this->itunes_author; + } + + /** + * Get the [itunes_keywords] column value. + * + * @return string + */ + public function getDbItunesKeywords() + { + + return $this->itunes_keywords; + } + + /** + * Get the [itunes_summary] column value. + * + * @return string + */ + public function getDbItunesSummary() + { + + return $this->itunes_summary; + } + + /** + * Get the [itunes_subtitle] column value. + * + * @return string + */ + public function getDbItunesSubtitle() + { + + return $this->itunes_subtitle; + } + + /** + * Get the [itunes_category] column value. + * + * @return string + */ + public function getDbItunesCategory() + { + + return $this->itunes_category; + } + + /** + * Get the [itunes_explicit] column value. + * + * @return string + */ + public function getDbItunesExplicit() + { + + return $this->itunes_explicit; + } + + /** + * Get the [owner] column value. + * + * @return int + */ + public function getDbOwner() + { + + return $this->owner; + } + + /** + * Set the value of [url] column. + * + * @param string $v new value + * @return ImportedPodcast The current object (for fluent API support) + */ + public function setDbUrl($v) + { + if ($v !== null && is_numeric($v)) { + $v = (string) $v; + } + + if ($this->url !== $v) { + $this->url = $v; + $this->modifiedColumns[] = ImportedPodcastPeer::URL; + } + + + return $this; + } // setDbUrl() + + /** + * Sets the value of the [auto_ingest] column. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * + * @param boolean|integer|string $v The new value + * @return ImportedPodcast The current object (for fluent API support) + */ + public function setDbAutoIngest($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->auto_ingest !== $v) { + $this->auto_ingest = $v; + $this->modifiedColumns[] = ImportedPodcastPeer::AUTO_INGEST; + } + + + return $this; + } // setDbAutoIngest() + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return ImportedPodcast The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = ImportedPodcastPeer::ID; + } + + 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 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() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->auto_ingest !== false) { + return false; + } + + // otherwise, everything was equal, so return true + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->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->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + $this->postHydrate($row, $startcol, $rehydrate); + + return $startcol + 16; // 16 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating ImportedPodcast object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aPodcast !== null && $this->id !== $this->aPodcast->getDbId()) { + $this->aPodcast = null; + } + if ($this->aCcSubjs !== null && $this->owner !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = ImportedPodcastPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aPodcast = null; + $this->aCcSubjs = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @throws Exception + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $deleteQuery = ImportedPodcastQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + // concrete_inheritance behavior + $this->getParentOrCreate($con)->delete($con); + + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @throws Exception + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + // concrete_inheritance behavior + $parent = $this->getSyncParent($con); + $parent->save($con); + $this->setPrimaryKey($parent->getPrimaryKey()); + + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + ImportedPodcastPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aPodcast !== null) { + if ($this->aPodcast->isModified() || $this->aPodcast->isNew()) { + $affectedRows += $this->aPodcast->save($con); + } + $this->setPodcast($this->aPodcast); + } + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param PropelPDO $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(PropelPDO $con) + { + $modifiedColumns = array(); + $index = 0; + + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(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"'; + } + + $sql = sprintf( + 'INSERT INTO "imported_podcast" (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case '"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); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); + } + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param PropelPDO $con + * + * @see doSave() + */ + protected function doUpdate(PropelPDO $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); + } + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + + return true; + } + + $this->validationFailures = $res; + + return false; + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggregated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aPodcast !== null) { + if (!$this->aPodcast->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aPodcast->getValidationFailures()); + } + } + + if ($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); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ImportedPodcastPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getDbUrl(); + break; + case 1: + return $this->getDbAutoIngest(); + break; + case 2: + return $this->getDbId(); + 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(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['ImportedPodcast'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['ImportedPodcast'][$this->getPrimaryKey()] = true; + $keys = ImportedPodcastPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->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(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aPodcast) { + $result['Podcast'] = $this->aPodcast->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ImportedPodcastPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + + $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setDbUrl($value); + break; + case 1: + $this->setDbAutoIngest($value); + break; + case 2: + $this->setDbId($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); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's BasePeer::TYPE_PHPNAME + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = ImportedPodcastPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->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]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); + + if ($this->isColumnModified(ImportedPodcastPeer::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); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); + $criteria->add(ImportedPodcastPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of ImportedPodcast (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->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()); + + if ($deepCopy && !$this->startCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + // store object hash to prevent cycle + $this->startCopy = true; + + $relObj = $this->getPodcast(); + if ($relObj) { + $copyObj->setPodcast($relObj->copy($deepCopy)); + } + + //unflag object copy + $this->startCopy = false; + } // if ($deepCopy) + + if ($makeNew) { + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return ImportedPodcast Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return ImportedPodcastPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ImportedPodcastPeer(); + } + + return self::$peer; + } + + /** + * Declares an association between this object and a Podcast object. + * + * @param Podcast $v + * @return ImportedPodcast The current object (for fluent API support) + * @throws PropelException + */ + public function setPodcast(Podcast $v = null) + { + if ($v === null) { + $this->setDbId(NULL); + } else { + $this->setDbId($v->getDbId()); + } + + $this->aPodcast = $v; + + // Add binding for other direction of this 1:1 relationship. + if ($v !== null) { + $v->setImportedPodcast($this); + } + + + return $this; + } + + + /** + * Get the associated Podcast object + * + * @param PropelPDO $con Optional Connection object. + * @param $doQuery Executes a query to get the object if required + * @return Podcast The associated Podcast object. + * @throws PropelException + */ + public function getPodcast(PropelPDO $con = null, $doQuery = true) + { + if ($this->aPodcast === null && ($this->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); + /* 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); + */ + } + + return $this->aCcSubjs; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $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->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->alreadyInClearAllReferencesDeep = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep && !$this->alreadyInClearAllReferencesDeep) { + $this->alreadyInClearAllReferencesDeep = true; + if ($this->aPodcast instanceof Persistent) { + $this->aPodcast->clearAllReferences($deep); + } + if ($this->aCcSubjs instanceof Persistent) { + $this->aCcSubjs->clearAllReferences($deep); + } + + $this->alreadyInClearAllReferencesDeep = false; + } // if ($deep) + + $this->aPodcast = null; + $this->aCcSubjs = null; + } + + /** + * return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ImportedPodcastPeer::DEFAULT_STRING_FORMAT); + } + + /** + * return true is the object is in saving state + * + * @return boolean + */ + public function isAlreadyInSave() + { + return $this->alreadyInSave; + } + + // concrete_inheritance behavior + + /** + * Get or Create the parent Podcast object of the current object + * + * @return Podcast The parent object + */ + public function getParentOrCreate($con = null) + { + 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'); + } + + return $parent; + } + } + + 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; + } + +} diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php new file mode 100644 index 000000000..710b5b2ec --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php @@ -0,0 +1,1459 @@ + 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, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. ImportedPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('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, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + public static function translateFieldName($name, $fromType, $toType) + { + $toNames = ImportedPodcastPeer::getFieldNames($toType); + $key = isset(ImportedPodcastPeer::$fieldKeys[$fromType][$name]) ? ImportedPodcastPeer::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ImportedPodcastPeer::$fieldKeys[$fromType], true)); + } + + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + * @throws PropelException - if the type is not valid. + */ + public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, ImportedPodcastPeer::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + + return ImportedPodcastPeer::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ImportedPodcastPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ImportedPodcastPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(ImportedPodcastPeer::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); + } else { + $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'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ImportedPodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + + return $count; + } + /** + * Selects one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return ImportedPodcast + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ImportedPodcastPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + + return null; + } + /** + * Selects several row from the DB. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return ImportedPodcastPeer::populateObjects(ImportedPodcastPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement directly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + ImportedPodcastPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param ImportedPodcast $obj A ImportedPodcast object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool($obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + ImportedPodcastPeer::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A ImportedPodcast object or a primary key value. + * + * @return void + * @throws PropelException - if the value is invalid. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof ImportedPodcast) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ImportedPodcast object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(ImportedPodcastPeer::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return ImportedPodcast Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(ImportedPodcastPeer::$instances[$key])) { + return ImportedPodcastPeer::$instances[$key]; + } + } + + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool($and_clear_all_references = false) + { + if ($and_clear_all_references) { + foreach (ImportedPodcastPeer::$instances as $instance) { + $instance->clearAllReferences(true); + } + } + ImportedPodcastPeer::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to imported_podcast + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or null if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return null. + if ($row[$startcol + 2] === null) { + return null; + } + + return (string) $row[$startcol + 2]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + + return (int) $row[$startcol + 2]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ImportedPodcastPeer::getOMClass(); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = ImportedPodcastPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ImportedPodcastPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (ImportedPodcast object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = ImportedPodcastPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + ImportedPodcastPeer::NUM_HYDRATE_COLUMNS; + } else { + $cls = ImportedPodcastPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + ImportedPodcastPeer::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + + /** + * Returns the number of rows matching criteria, joining the related Podcast table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinPodcast(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ImportedPodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(ImportedPodcastPeer::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); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + + return $count; + } + + + /** + * Selects a collection of ImportedPodcast objects pre-filled with their Podcast objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of ImportedPodcast objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinPodcast(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + } + + ImportedPodcastPeer::addSelectColumns($criteria); + $startcol = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS; + PodcastPeer::addSelectColumns($criteria); + + $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ImportedPodcastPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = ImportedPodcastPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + ImportedPodcastPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = PodcastPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = PodcastPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + PodcastPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (ImportedPodcast) to $obj2 (Podcast) + // 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 + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + ImportedPodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(ImportedPodcastPeer::ID, PodcastPeer::ID, $join_behavior); + + $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; + } + + /** + * Selects a collection of ImportedPodcast objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of ImportedPodcast objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + } + + ImportedPodcastPeer::addSelectColumns($criteria); + $startcol2 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS; + + PodcastPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS; + + 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); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = ImportedPodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = ImportedPodcastPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = ImportedPodcastPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + ImportedPodcastPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined Podcast rows + + $key2 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = PodcastPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = PodcastPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + PodcastPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (ImportedPodcast) to the collection in $obj2 (Podcast) + $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 + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(ImportedPodcastPeer::DATABASE_NAME)->getTable(ImportedPodcastPeer::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseImportedPodcastPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseImportedPodcastPeer::TABLE_NAME)) { + $dbMap->addTableObject(new \ImportedPodcastTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * + * @return string ClassName + */ + public static function getOMClass($row = 0, $colnum = 0) + { + return ImportedPodcastPeer::OM_CLASS; + } + + /** + * Performs an INSERT on the database, given a ImportedPodcast or Criteria object. + * + * @param mixed $values Criteria or ImportedPodcast object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from ImportedPodcast object + } + + + // Set the correct dbName + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Performs an UPDATE on the database, given a ImportedPodcast or Criteria object. + * + * @param mixed $values Criteria or ImportedPodcast object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ImportedPodcastPeer::ID); + $value = $criteria->remove(ImportedPodcastPeer::ID); + if ($value) { + $selectCriteria->add(ImportedPodcastPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(ImportedPodcastPeer::TABLE_NAME); + } + + } else { // $values is ImportedPodcast object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Deletes all rows from the imported_podcast table. + * + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException + */ + public static function doDeleteAll(PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(ImportedPodcastPeer::TABLE_NAME, $con, ImportedPodcastPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + ImportedPodcastPeer::clearInstancePool(); + ImportedPodcastPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs a DELETE on the database, given a ImportedPodcast or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ImportedPodcast object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + ImportedPodcastPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof ImportedPodcast) { // it's a model object + // invalidate the cache for this single object + ImportedPodcastPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); + $criteria->add(ImportedPodcastPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + ImportedPodcastPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(ImportedPodcastPeer::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + ImportedPodcastPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given ImportedPodcast object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param ImportedPodcast $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate($obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ImportedPodcastPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ImportedPodcastPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->hasColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(ImportedPodcastPeer::DATABASE_NAME, ImportedPodcastPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return ImportedPodcast + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = ImportedPodcastPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); + $criteria->add(ImportedPodcastPeer::ID, $pk); + + $v = ImportedPodcastPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @return ImportedPodcast[] + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); + $criteria->add(ImportedPodcastPeer::ID, $pks, Criteria::IN); + $objs = ImportedPodcastPeer::doSelect($criteria, $con); + } + + return $objs; + } + +} // BaseImportedPodcastPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseImportedPodcastPeer::buildTableMap(); + diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php new file mode 100644 index 000000000..78432daef --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php @@ -0,0 +1,946 @@ +mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return ImportedPodcast|ImportedPodcast[]|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ImportedPodcastPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getConnection(ImportedPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Alias of findPk to use instance pooling + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con A connection object + * + * @return ImportedPodcast A model object, or null if the key is not found + * @throws PropelException + */ + public function findOneByDbId($key, $con = null) + { + return $this->findPk($key, $con); + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con A connection object + * + * @return ImportedPodcast A model object, or null if the key is not found + * @throws PropelException + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT "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'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key, PDO::PARAM_INT); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); + } + $obj = null; + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $obj = new ImportedPodcast(); + $obj->hydrate($row); + ImportedPodcastPeer::addInstanceToPool($obj, (string) $key); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con A connection object + * + * @return ImportedPodcast|ImportedPodcast[]|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|ImportedPodcast[]|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if ($con === null) { + $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($stmt); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ImportedPodcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(ImportedPodcastPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ImportedPodcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(ImportedPodcastPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the url column + * + * Example usage: + * + * $query->filterByDbUrl('fooValue'); // WHERE url = 'fooValue' + * $query->filterByDbUrl('%fooValue%'); // WHERE url LIKE '%fooValue%' + * + * + * @param string $dbUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ImportedPodcastQuery The current query, for fluid interface + */ + public function filterByDbUrl($dbUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbUrl)) { + $dbUrl = str_replace('*', '%', $dbUrl); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(ImportedPodcastPeer::URL, $dbUrl, $comparison); + } + + /** + * Filter the query on the auto_ingest column + * + * Example usage: + * + * $query->filterByDbAutoIngest(true); // WHERE auto_ingest = true + * $query->filterByDbAutoIngest('yes'); // WHERE auto_ingest = true + * + * + * @param boolean|string $dbAutoIngest The value to use as filter. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ImportedPodcastQuery The current query, for fluid interface + */ + public function filterByDbAutoIngest($dbAutoIngest = null, $comparison = null) + { + if (is_string($dbAutoIngest)) { + $dbAutoIngest = in_array(strtolower($dbAutoIngest), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(ImportedPodcastPeer::AUTO_INGEST, $dbAutoIngest, $comparison); + } + + /** + * Filter the query on the 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 + * + * + * @see filterByPodcast() + * + * @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 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); + } + + /** + * Filter the query by a related Podcast object + * + * @param Podcast|PropelObjectCollection $podcast The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ImportedPodcastQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByPodcast($podcast, $comparison = null) + { + if ($podcast instanceof Podcast) { + return $this + ->addUsingAlias(ImportedPodcastPeer::ID, $podcast->getDbId(), $comparison); + } elseif ($podcast instanceof PropelObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ImportedPodcastPeer::ID, $podcast->toKeyValue('PrimaryKey', 'DbId'), $comparison); + } else { + throw new PropelException('filterByPodcast() only accepts arguments of type Podcast or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the Podcast relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ImportedPodcastQuery The current query, for fluid interface + */ + public function joinPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Podcast'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Podcast'); + } + + return $this; + } + + /** + * Use the Podcast relation Podcast object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return PodcastQuery A secondary query class using the current class as primary query + */ + public function usePodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinPodcast($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Podcast', 'PodcastQuery'); + } + + /** + * 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 + * + * @param ImportedPodcast $importedPodcast Object to remove from the list of results + * + * @return ImportedPodcastQuery The current query, for fluid interface + */ + public function prune($importedPodcast = null) + { + if ($importedPodcast) { + $this->addUsingAlias(ImportedPodcastPeer::ID, $importedPodcast->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} diff --git a/airtime_mvc/application/models/airtime/om/BasePodcast.php b/airtime_mvc/application/models/airtime/om/BasePodcast.php index e321c762c..e660eab65 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcast.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcast.php @@ -35,12 +35,6 @@ abstract class BasePodcast extends BaseObject implements Persistent */ protected $id; - /** - * The value for the url field. - * @var string - */ - protected $url; - /** * The value for the title field. * @var string @@ -71,6 +65,12 @@ abstract class BasePodcast extends BaseObject implements Persistent */ protected $copyright; + /** + * The value for the link field. + * @var string + */ + protected $link; + /** * The value for the itunes_author field. * @var string @@ -107,13 +107,6 @@ abstract class BasePodcast extends BaseObject implements Persistent */ protected $itunes_explicit; - /** - * The value for the auto_ingest field. - * Note: this column has a database default value of: false - * @var boolean - */ - protected $auto_ingest; - /** * The value for the owner field. * @var int @@ -121,11 +114,10 @@ abstract class BasePodcast extends BaseObject implements Persistent protected $owner; /** - * The value for the type field. - * Note: this column has a database default value of: 1 - * @var int + * The value for the descendant_class field. + * @var string */ - protected $type; + protected $descendant_class; /** * @var CcSubjs @@ -138,6 +130,16 @@ abstract class BasePodcast extends BaseObject implements Persistent 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. @@ -164,28 +166,6 @@ abstract class BasePodcast extends BaseObject implements Persistent */ protected $podcastEpisodessScheduledForDeletion = null; - /** - * Applies default values to this object. - * This method should be called from the object's constructor (or - * equivalent initialization method). - * @see __construct() - */ - public function applyDefaultValues() - { - $this->auto_ingest = false; - $this->type = 1; - } - - /** - * Initializes internal state of BasePodcast object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - /** * Get the [id] column value. * @@ -197,17 +177,6 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->id; } - /** - * Get the [url] column value. - * - * @return string - */ - public function getDbUrl() - { - - return $this->url; - } - /** * Get the [title] column value. * @@ -263,6 +232,17 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->copyright; } + /** + * Get the [link] column value. + * + * @return string + */ + public function getDbLink() + { + + return $this->link; + } + /** * Get the [itunes_author] column value. * @@ -329,17 +309,6 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->itunes_explicit; } - /** - * Get the [auto_ingest] column value. - * - * @return boolean - */ - public function getDbAutoIngest() - { - - return $this->auto_ingest; - } - /** * Get the [owner] column value. * @@ -352,14 +321,14 @@ abstract class BasePodcast extends BaseObject implements Persistent } /** - * Get the [type] column value. + * Get the [descendant_class] column value. * - * @return int + * @return string */ - public function getDbType() + public function getDescendantClass() { - return $this->type; + return $this->descendant_class; } /** @@ -383,27 +352,6 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this; } // setDbId() - /** - * Set the value of [url] column. - * - * @param string $v new value - * @return Podcast The current object (for fluent API support) - */ - public function setDbUrl($v) - { - if ($v !== null && is_numeric($v)) { - $v = (string) $v; - } - - if ($this->url !== $v) { - $this->url = $v; - $this->modifiedColumns[] = PodcastPeer::URL; - } - - - return $this; - } // setDbUrl() - /** * Set the value of [title] column. * @@ -509,6 +457,27 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this; } // setDbCopyright() + /** + * Set the value of [link] column. + * + * @param string $v new value + * @return Podcast The current object (for fluent API support) + */ + public function setDbLink($v) + { + if ($v !== null && is_numeric($v)) { + $v = (string) $v; + } + + if ($this->link !== $v) { + $this->link = $v; + $this->modifiedColumns[] = PodcastPeer::LINK; + } + + + return $this; + } // setDbLink() + /** * Set the value of [itunes_author] column. * @@ -635,35 +604,6 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this; } // setDbItunesExplicit() - /** - * Sets the value of the [auto_ingest] column. - * Non-boolean arguments are converted using the following rules: - * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true - * * 0, '0', 'false', 'off', and 'no' are converted to boolean false - * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * - * @param boolean|integer|string $v The new value - * @return Podcast The current object (for fluent API support) - */ - public function setDbAutoIngest($v) - { - if ($v !== null) { - if (is_string($v)) { - $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; - } else { - $v = (boolean) $v; - } - } - - if ($this->auto_ingest !== $v) { - $this->auto_ingest = $v; - $this->modifiedColumns[] = PodcastPeer::AUTO_INGEST; - } - - - return $this; - } // setDbAutoIngest() - /** * Set the value of [owner] column. * @@ -690,25 +630,25 @@ abstract class BasePodcast extends BaseObject implements Persistent } // setDbOwner() /** - * Set the value of [type] column. + * Set the value of [descendant_class] column. * - * @param int $v new value + * @param string $v new value * @return Podcast The current object (for fluent API support) */ - public function setDbType($v) + public function setDescendantClass($v) { if ($v !== null && is_numeric($v)) { - $v = (int) $v; + $v = (string) $v; } - if ($this->type !== $v) { - $this->type = $v; - $this->modifiedColumns[] = PodcastPeer::TYPE; + if ($this->descendant_class !== $v) { + $this->descendant_class = $v; + $this->modifiedColumns[] = PodcastPeer::DESCENDANT_CLASS; } return $this; - } // setDbType() + } // setDescendantClass() /** * Indicates whether the columns in this object are only set to default values. @@ -720,14 +660,6 @@ abstract class BasePodcast extends BaseObject implements Persistent */ public function hasOnlyDefaultValues() { - if ($this->auto_ingest !== false) { - return false; - } - - if ($this->type !== 1) { - return false; - } - // otherwise, everything was equal, so return true return true; } // hasOnlyDefaultValues() @@ -751,21 +683,20 @@ abstract class BasePodcast extends BaseObject implements Persistent try { $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->url = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->creator = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->language = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->copyright = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->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->auto_ingest = ($row[$startcol + 13] !== null) ? (boolean) $row[$startcol + 13] : null; - $this->owner = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; - $this->type = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : 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); @@ -775,7 +706,7 @@ abstract class BasePodcast extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 16; // 16 = PodcastPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = PodcastPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating Podcast object", $e); @@ -843,6 +774,10 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->aCcSubjs = null; $this->collPodcastEpisodess = null; + $this->singleStationPodcast = null; + + $this->singleImportedPodcast = null; + } // if (deep) } @@ -996,6 +931,18 @@ 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; } @@ -1035,9 +982,6 @@ abstract class BasePodcast extends BaseObject implements Persistent if ($this->isColumnModified(PodcastPeer::ID)) { $modifiedColumns[':p' . $index++] = '"id"'; } - if ($this->isColumnModified(PodcastPeer::URL)) { - $modifiedColumns[':p' . $index++] = '"url"'; - } if ($this->isColumnModified(PodcastPeer::TITLE)) { $modifiedColumns[':p' . $index++] = '"title"'; } @@ -1053,6 +997,9 @@ abstract class BasePodcast extends BaseObject implements Persistent if ($this->isColumnModified(PodcastPeer::COPYRIGHT)) { $modifiedColumns[':p' . $index++] = '"copyright"'; } + if ($this->isColumnModified(PodcastPeer::LINK)) { + $modifiedColumns[':p' . $index++] = '"link"'; + } if ($this->isColumnModified(PodcastPeer::ITUNES_AUTHOR)) { $modifiedColumns[':p' . $index++] = '"itunes_author"'; } @@ -1071,14 +1018,11 @@ abstract class BasePodcast extends BaseObject implements Persistent if ($this->isColumnModified(PodcastPeer::ITUNES_EXPLICIT)) { $modifiedColumns[':p' . $index++] = '"itunes_explicit"'; } - if ($this->isColumnModified(PodcastPeer::AUTO_INGEST)) { - $modifiedColumns[':p' . $index++] = '"auto_ingest"'; - } if ($this->isColumnModified(PodcastPeer::OWNER)) { $modifiedColumns[':p' . $index++] = '"owner"'; } - if ($this->isColumnModified(PodcastPeer::TYPE)) { - $modifiedColumns[':p' . $index++] = '"type"'; + if ($this->isColumnModified(PodcastPeer::DESCENDANT_CLASS)) { + $modifiedColumns[':p' . $index++] = '"descendant_class"'; } $sql = sprintf( @@ -1094,9 +1038,6 @@ abstract class BasePodcast extends BaseObject implements Persistent case '"id"': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case '"url"': - $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); - break; case '"title"': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; @@ -1112,6 +1053,9 @@ abstract class BasePodcast extends BaseObject implements Persistent 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; @@ -1130,14 +1074,11 @@ abstract class BasePodcast extends BaseObject implements Persistent case '"itunes_explicit"': $stmt->bindValue($identifier, $this->itunes_explicit, PDO::PARAM_STR); break; - case '"auto_ingest"': - $stmt->bindValue($identifier, $this->auto_ingest, PDO::PARAM_BOOL); - break; case '"owner"': $stmt->bindValue($identifier, $this->owner, PDO::PARAM_INT); break; - case '"type"': - $stmt->bindValue($identifier, $this->type, PDO::PARAM_INT); + case '"descendant_class"': + $stmt->bindValue($identifier, $this->descendant_class, PDO::PARAM_STR); break; } } @@ -1251,6 +1192,18 @@ abstract class BasePodcast extends BaseObject implements Persistent } } + if ($this->singleStationPodcast !== null) { + if (!$this->singleStationPodcast->validate($columns)) { + $failureMap = array_merge($failureMap, $this->singleStationPodcast->getValidationFailures()); + } + } + + if ($this->singleImportedPodcast !== null) { + if (!$this->singleImportedPodcast->validate($columns)) { + $failureMap = array_merge($failureMap, $this->singleImportedPodcast->getValidationFailures()); + } + } + $this->alreadyInValidation = false; } @@ -1290,23 +1243,23 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->getDbId(); break; case 1: - return $this->getDbUrl(); - break; - case 2: return $this->getDbTitle(); break; - case 3: + case 2: return $this->getDbCreator(); break; - case 4: + case 3: return $this->getDbDescription(); break; - case 5: + case 4: return $this->getDbLanguage(); break; - case 6: + case 5: return $this->getDbCopyright(); break; + case 6: + return $this->getDbLink(); + break; case 7: return $this->getDbItunesAuthor(); break; @@ -1326,13 +1279,10 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->getDbItunesExplicit(); break; case 13: - return $this->getDbAutoIngest(); - break; - case 14: return $this->getDbOwner(); break; - case 15: - return $this->getDbType(); + case 14: + return $this->getDescendantClass(); break; default: return null; @@ -1364,21 +1314,20 @@ abstract class BasePodcast extends BaseObject implements Persistent $keys = PodcastPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getDbId(), - $keys[1] => $this->getDbUrl(), - $keys[2] => $this->getDbTitle(), - $keys[3] => $this->getDbCreator(), - $keys[4] => $this->getDbDescription(), - $keys[5] => $this->getDbLanguage(), - $keys[6] => $this->getDbCopyright(), + $keys[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->getDbAutoIngest(), - $keys[14] => $this->getDbOwner(), - $keys[15] => $this->getDbType(), + $keys[13] => $this->getDbOwner(), + $keys[14] => $this->getDescendantClass(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1392,6 +1341,12 @@ abstract class BasePodcast extends BaseObject implements Persistent 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; @@ -1430,23 +1385,23 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->setDbId($value); break; case 1: - $this->setDbUrl($value); - break; - case 2: $this->setDbTitle($value); break; - case 3: + case 2: $this->setDbCreator($value); break; - case 4: + case 3: $this->setDbDescription($value); break; - case 5: + case 4: $this->setDbLanguage($value); break; - case 6: + case 5: $this->setDbCopyright($value); break; + case 6: + $this->setDbLink($value); + break; case 7: $this->setDbItunesAuthor($value); break; @@ -1466,13 +1421,10 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->setDbItunesExplicit($value); break; case 13: - $this->setDbAutoIngest($value); - break; - case 14: $this->setDbOwner($value); break; - case 15: - $this->setDbType($value); + case 14: + $this->setDescendantClass($value); break; } // switch() } @@ -1499,21 +1451,20 @@ abstract class BasePodcast extends BaseObject implements Persistent $keys = PodcastPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setDbUrl($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbTitle($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbCreator($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbLanguage($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDbCopyright($arr[$keys[6]]); + if (array_key_exists($keys[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->setDbAutoIngest($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setDbOwner($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setDbType($arr[$keys[15]]); + if (array_key_exists($keys[13], $arr)) $this->setDbOwner($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setDescendantClass($arr[$keys[14]]); } /** @@ -1526,21 +1477,20 @@ abstract class BasePodcast extends BaseObject implements Persistent $criteria = new Criteria(PodcastPeer::DATABASE_NAME); if ($this->isColumnModified(PodcastPeer::ID)) $criteria->add(PodcastPeer::ID, $this->id); - if ($this->isColumnModified(PodcastPeer::URL)) $criteria->add(PodcastPeer::URL, $this->url); if ($this->isColumnModified(PodcastPeer::TITLE)) $criteria->add(PodcastPeer::TITLE, $this->title); if ($this->isColumnModified(PodcastPeer::CREATOR)) $criteria->add(PodcastPeer::CREATOR, $this->creator); if ($this->isColumnModified(PodcastPeer::DESCRIPTION)) $criteria->add(PodcastPeer::DESCRIPTION, $this->description); if ($this->isColumnModified(PodcastPeer::LANGUAGE)) $criteria->add(PodcastPeer::LANGUAGE, $this->language); if ($this->isColumnModified(PodcastPeer::COPYRIGHT)) $criteria->add(PodcastPeer::COPYRIGHT, $this->copyright); + if ($this->isColumnModified(PodcastPeer::LINK)) $criteria->add(PodcastPeer::LINK, $this->link); if ($this->isColumnModified(PodcastPeer::ITUNES_AUTHOR)) $criteria->add(PodcastPeer::ITUNES_AUTHOR, $this->itunes_author); if ($this->isColumnModified(PodcastPeer::ITUNES_KEYWORDS)) $criteria->add(PodcastPeer::ITUNES_KEYWORDS, $this->itunes_keywords); if ($this->isColumnModified(PodcastPeer::ITUNES_SUMMARY)) $criteria->add(PodcastPeer::ITUNES_SUMMARY, $this->itunes_summary); if ($this->isColumnModified(PodcastPeer::ITUNES_SUBTITLE)) $criteria->add(PodcastPeer::ITUNES_SUBTITLE, $this->itunes_subtitle); if ($this->isColumnModified(PodcastPeer::ITUNES_CATEGORY)) $criteria->add(PodcastPeer::ITUNES_CATEGORY, $this->itunes_category); if ($this->isColumnModified(PodcastPeer::ITUNES_EXPLICIT)) $criteria->add(PodcastPeer::ITUNES_EXPLICIT, $this->itunes_explicit); - if ($this->isColumnModified(PodcastPeer::AUTO_INGEST)) $criteria->add(PodcastPeer::AUTO_INGEST, $this->auto_ingest); if ($this->isColumnModified(PodcastPeer::OWNER)) $criteria->add(PodcastPeer::OWNER, $this->owner); - if ($this->isColumnModified(PodcastPeer::TYPE)) $criteria->add(PodcastPeer::TYPE, $this->type); + if ($this->isColumnModified(PodcastPeer::DESCENDANT_CLASS)) $criteria->add(PodcastPeer::DESCENDANT_CLASS, $this->descendant_class); return $criteria; } @@ -1604,21 +1554,20 @@ abstract class BasePodcast extends BaseObject implements Persistent */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setDbUrl($this->getDbUrl()); $copyObj->setDbTitle($this->getDbTitle()); $copyObj->setDbCreator($this->getDbCreator()); $copyObj->setDbDescription($this->getDbDescription()); $copyObj->setDbLanguage($this->getDbLanguage()); $copyObj->setDbCopyright($this->getDbCopyright()); + $copyObj->setDbLink($this->getDbLink()); $copyObj->setDbItunesAuthor($this->getDbItunesAuthor()); $copyObj->setDbItunesKeywords($this->getDbItunesKeywords()); $copyObj->setDbItunesSummary($this->getDbItunesSummary()); $copyObj->setDbItunesSubtitle($this->getDbItunesSubtitle()); $copyObj->setDbItunesCategory($this->getDbItunesCategory()); $copyObj->setDbItunesExplicit($this->getDbItunesExplicit()); - $copyObj->setDbAutoIngest($this->getDbAutoIngest()); $copyObj->setDbOwner($this->getDbOwner()); - $copyObj->setDbType($this->getDbType()); + $copyObj->setDescendantClass($this->getDescendantClass()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1633,6 +1582,16 @@ abstract class BasePodcast extends BaseObject implements Persistent } } + $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) @@ -2001,32 +1960,102 @@ 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 */ public function clear() { $this->id = null; - $this->url = null; $this->title = null; $this->creator = null; $this->description = null; $this->language = null; $this->copyright = null; + $this->link = null; $this->itunes_author = null; $this->itunes_keywords = null; $this->itunes_summary = null; $this->itunes_subtitle = null; $this->itunes_category = null; $this->itunes_explicit = null; - $this->auto_ingest = null; $this->owner = null; - $this->type = null; + $this->descendant_class = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; $this->clearAllReferences(); - $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); @@ -2050,6 +2079,12 @@ abstract class BasePodcast extends BaseObject implements Persistent $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); } @@ -2061,6 +2096,14 @@ abstract class BasePodcast extends BaseObject implements Persistent $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; } @@ -2084,4 +2127,32 @@ 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 6782ea04b..0ff1c372b 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php @@ -18,26 +18,23 @@ abstract class BasePodcastPeer const TABLE_NAME = 'podcast'; /** the related Propel class for this table */ - const OM_CLASS = 'Podcast'; + const OM_CLASS = ''; /** the related TableMap class for this table */ const TM_CLASS = 'PodcastTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 16; + const NUM_COLUMNS = 15; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 16; + const NUM_HYDRATE_COLUMNS = 15; /** the column name for the id field */ const ID = 'podcast.id'; - /** the column name for the url field */ - const URL = 'podcast.url'; - /** the column name for the title field */ const TITLE = 'podcast.title'; @@ -53,6 +50,9 @@ abstract class BasePodcastPeer /** the column name for the copyright field */ const COPYRIGHT = 'podcast.copyright'; + /** the column name for the link field */ + const LINK = 'podcast.link'; + /** the column name for the itunes_author field */ const ITUNES_AUTHOR = 'podcast.itunes_author'; @@ -71,14 +71,11 @@ abstract class BasePodcastPeer /** the column name for the itunes_explicit field */ const ITUNES_EXPLICIT = 'podcast.itunes_explicit'; - /** the column name for the auto_ingest field */ - const AUTO_INGEST = 'podcast.auto_ingest'; - /** the column name for the owner field */ const OWNER = 'podcast.owner'; - /** the column name for the type field */ - const TYPE = 'podcast.type'; + /** 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'; @@ -99,12 +96,12 @@ abstract class BasePodcastPeer * e.g. PodcastPeer::$fieldNames[PodcastPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbUrl', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbAutoIngest', 'DbOwner', 'DbType', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUrl', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbAutoIngest', 'dbOwner', 'dbType', ), - BasePeer::TYPE_COLNAME => array (PodcastPeer::ID, PodcastPeer::URL, PodcastPeer::TITLE, PodcastPeer::CREATOR, PodcastPeer::DESCRIPTION, PodcastPeer::LANGUAGE, PodcastPeer::COPYRIGHT, PodcastPeer::ITUNES_AUTHOR, PodcastPeer::ITUNES_KEYWORDS, PodcastPeer::ITUNES_SUMMARY, PodcastPeer::ITUNES_SUBTITLE, PodcastPeer::ITUNES_CATEGORY, PodcastPeer::ITUNES_EXPLICIT, PodcastPeer::AUTO_INGEST, PodcastPeer::OWNER, PodcastPeer::TYPE, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'URL', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'AUTO_INGEST', 'OWNER', 'TYPE', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'url', 'title', 'creator', 'description', 'language', 'copyright', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'auto_ingest', 'owner', 'type', ), - 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', '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, ) ); /** @@ -114,12 +111,12 @@ abstract class BasePodcastPeer * e.g. PodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbUrl' => 1, 'DbTitle' => 2, 'DbCreator' => 3, 'DbDescription' => 4, 'DbLanguage' => 5, 'DbCopyright' => 6, 'DbItunesAuthor' => 7, 'DbItunesKeywords' => 8, 'DbItunesSummary' => 9, 'DbItunesSubtitle' => 10, 'DbItunesCategory' => 11, 'DbItunesExplicit' => 12, 'DbAutoIngest' => 13, 'DbOwner' => 14, 'DbType' => 15, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUrl' => 1, 'dbTitle' => 2, 'dbCreator' => 3, 'dbDescription' => 4, 'dbLanguage' => 5, 'dbCopyright' => 6, 'dbItunesAuthor' => 7, 'dbItunesKeywords' => 8, 'dbItunesSummary' => 9, 'dbItunesSubtitle' => 10, 'dbItunesCategory' => 11, 'dbItunesExplicit' => 12, 'dbAutoIngest' => 13, 'dbOwner' => 14, 'dbType' => 15, ), - BasePeer::TYPE_COLNAME => array (PodcastPeer::ID => 0, PodcastPeer::URL => 1, PodcastPeer::TITLE => 2, PodcastPeer::CREATOR => 3, PodcastPeer::DESCRIPTION => 4, PodcastPeer::LANGUAGE => 5, PodcastPeer::COPYRIGHT => 6, PodcastPeer::ITUNES_AUTHOR => 7, PodcastPeer::ITUNES_KEYWORDS => 8, PodcastPeer::ITUNES_SUMMARY => 9, PodcastPeer::ITUNES_SUBTITLE => 10, PodcastPeer::ITUNES_CATEGORY => 11, PodcastPeer::ITUNES_EXPLICIT => 12, PodcastPeer::AUTO_INGEST => 13, PodcastPeer::OWNER => 14, PodcastPeer::TYPE => 15, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'URL' => 1, 'TITLE' => 2, 'CREATOR' => 3, 'DESCRIPTION' => 4, 'LANGUAGE' => 5, 'COPYRIGHT' => 6, 'ITUNES_AUTHOR' => 7, 'ITUNES_KEYWORDS' => 8, 'ITUNES_SUMMARY' => 9, 'ITUNES_SUBTITLE' => 10, 'ITUNES_CATEGORY' => 11, 'ITUNES_EXPLICIT' => 12, 'AUTO_INGEST' => 13, 'OWNER' => 14, 'TYPE' => 15, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'url' => 1, 'title' => 2, 'creator' => 3, 'description' => 4, 'language' => 5, 'copyright' => 6, 'itunes_author' => 7, 'itunes_keywords' => 8, 'itunes_summary' => 9, 'itunes_subtitle' => 10, 'itunes_category' => 11, 'itunes_explicit' => 12, 'auto_ingest' => 13, 'owner' => 14, 'type' => 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, '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, ) ); /** @@ -194,38 +191,36 @@ abstract class BasePodcastPeer { if (null === $alias) { $criteria->addSelectColumn(PodcastPeer::ID); - $criteria->addSelectColumn(PodcastPeer::URL); $criteria->addSelectColumn(PodcastPeer::TITLE); $criteria->addSelectColumn(PodcastPeer::CREATOR); $criteria->addSelectColumn(PodcastPeer::DESCRIPTION); $criteria->addSelectColumn(PodcastPeer::LANGUAGE); $criteria->addSelectColumn(PodcastPeer::COPYRIGHT); + $criteria->addSelectColumn(PodcastPeer::LINK); $criteria->addSelectColumn(PodcastPeer::ITUNES_AUTHOR); $criteria->addSelectColumn(PodcastPeer::ITUNES_KEYWORDS); $criteria->addSelectColumn(PodcastPeer::ITUNES_SUMMARY); $criteria->addSelectColumn(PodcastPeer::ITUNES_SUBTITLE); $criteria->addSelectColumn(PodcastPeer::ITUNES_CATEGORY); $criteria->addSelectColumn(PodcastPeer::ITUNES_EXPLICIT); - $criteria->addSelectColumn(PodcastPeer::AUTO_INGEST); $criteria->addSelectColumn(PodcastPeer::OWNER); - $criteria->addSelectColumn(PodcastPeer::TYPE); + $criteria->addSelectColumn(PodcastPeer::DESCENDANT_CLASS); } else { $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.url'); $criteria->addSelectColumn($alias . '.title'); $criteria->addSelectColumn($alias . '.creator'); $criteria->addSelectColumn($alias . '.description'); $criteria->addSelectColumn($alias . '.language'); $criteria->addSelectColumn($alias . '.copyright'); + $criteria->addSelectColumn($alias . '.link'); $criteria->addSelectColumn($alias . '.itunes_author'); $criteria->addSelectColumn($alias . '.itunes_keywords'); $criteria->addSelectColumn($alias . '.itunes_summary'); $criteria->addSelectColumn($alias . '.itunes_subtitle'); $criteria->addSelectColumn($alias . '.itunes_category'); $criteria->addSelectColumn($alias . '.itunes_explicit'); - $criteria->addSelectColumn($alias . '.auto_ingest'); $criteria->addSelectColumn($alias . '.owner'); - $criteria->addSelectColumn($alias . '.type'); + $criteria->addSelectColumn($alias . '.descendant_class'); } } @@ -433,6 +428,12 @@ abstract class BasePodcastPeer // 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(); } /** @@ -519,6 +520,11 @@ 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(); @@ -793,13 +799,10 @@ abstract class BasePodcastPeer /** * The class that the Peer will make instances of. * - * - * @return string ClassName + * This method must be overridden by the stub subclass, because + * Podcast is declared abstract in the schema. */ - public static function getOMClass($row = 0, $colnum = 0) - { - return PodcastPeer::OM_CLASS; - } + abstract public static function getOMClass($row = 0, $colnum = 0); /** * 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 e943e58d8..8fe7fd64d 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php @@ -7,38 +7,36 @@ * * * @method PodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column - * @method PodcastQuery orderByDbUrl($order = Criteria::ASC) Order by the url column * @method PodcastQuery orderByDbTitle($order = Criteria::ASC) Order by the title column * @method PodcastQuery orderByDbCreator($order = Criteria::ASC) Order by the creator column * @method PodcastQuery orderByDbDescription($order = Criteria::ASC) Order by the description column * @method PodcastQuery orderByDbLanguage($order = Criteria::ASC) Order by the language column * @method PodcastQuery orderByDbCopyright($order = Criteria::ASC) Order by the copyright column + * @method PodcastQuery orderByDbLink($order = Criteria::ASC) Order by the link column * @method PodcastQuery orderByDbItunesAuthor($order = Criteria::ASC) Order by the itunes_author column * @method PodcastQuery orderByDbItunesKeywords($order = Criteria::ASC) Order by the itunes_keywords column * @method PodcastQuery orderByDbItunesSummary($order = Criteria::ASC) Order by the itunes_summary column * @method PodcastQuery orderByDbItunesSubtitle($order = Criteria::ASC) Order by the itunes_subtitle column * @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 orderByDbAutoIngest($order = Criteria::ASC) Order by the auto_ingest column * @method PodcastQuery orderByDbOwner($order = Criteria::ASC) Order by the owner column - * @method PodcastQuery orderByDbType($order = Criteria::ASC) Order by the type column + * @method PodcastQuery orderByDescendantClass($order = Criteria::ASC) Order by the descendant_class column * * @method PodcastQuery groupByDbId() Group by the id column - * @method PodcastQuery groupByDbUrl() Group by the url column * @method PodcastQuery groupByDbTitle() Group by the title column * @method PodcastQuery groupByDbCreator() Group by the creator column * @method PodcastQuery groupByDbDescription() Group by the description column * @method PodcastQuery groupByDbLanguage() Group by the language column * @method PodcastQuery groupByDbCopyright() Group by the copyright column + * @method PodcastQuery groupByDbLink() Group by the link column * @method PodcastQuery groupByDbItunesAuthor() Group by the itunes_author column * @method PodcastQuery groupByDbItunesKeywords() Group by the itunes_keywords column * @method PodcastQuery groupByDbItunesSummary() Group by the itunes_summary column * @method PodcastQuery groupByDbItunesSubtitle() Group by the itunes_subtitle column * @method PodcastQuery groupByDbItunesCategory() Group by the itunes_category column * @method PodcastQuery groupByDbItunesExplicit() Group by the itunes_explicit column - * @method PodcastQuery groupByDbAutoIngest() Group by the auto_ingest column * @method PodcastQuery groupByDbOwner() Group by the owner column - * @method PodcastQuery groupByDbType() Group by the type 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 @@ -52,41 +50,47 @@ * @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 + * + * @method PodcastQuery leftJoinImportedPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportedPodcast relation + * @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 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 * - * @method Podcast findOneByDbUrl(string $url) Return the first Podcast filtered by the url column * @method Podcast findOneByDbTitle(string $title) Return the first Podcast filtered by the title column * @method Podcast findOneByDbCreator(string $creator) Return the first Podcast filtered by the creator column * @method Podcast findOneByDbDescription(string $description) Return the first Podcast filtered by the description column * @method Podcast findOneByDbLanguage(string $language) Return the first Podcast filtered by the language column * @method Podcast findOneByDbCopyright(string $copyright) Return the first Podcast filtered by the copyright column + * @method Podcast findOneByDbLink(string $link) Return the first Podcast filtered by the link column * @method Podcast findOneByDbItunesAuthor(string $itunes_author) Return the first Podcast filtered by the itunes_author column * @method Podcast findOneByDbItunesKeywords(string $itunes_keywords) Return the first Podcast filtered by the itunes_keywords column * @method Podcast findOneByDbItunesSummary(string $itunes_summary) Return the first Podcast filtered by the itunes_summary column * @method Podcast findOneByDbItunesSubtitle(string $itunes_subtitle) Return the first Podcast filtered by the itunes_subtitle column * @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 findOneByDbAutoIngest(boolean $auto_ingest) Return the first Podcast filtered by the auto_ingest column * @method Podcast findOneByDbOwner(int $owner) Return the first Podcast filtered by the owner column - * @method Podcast findOneByDbType(int $type) Return the first Podcast filtered by the type 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 findByDbUrl(string $url) Return Podcast objects filtered by the url column * @method array findByDbTitle(string $title) Return Podcast objects filtered by the title column * @method array findByDbCreator(string $creator) Return Podcast objects filtered by the creator column * @method array findByDbDescription(string $description) Return Podcast objects filtered by the description column * @method array findByDbLanguage(string $language) Return Podcast objects filtered by the language column * @method array findByDbCopyright(string $copyright) Return Podcast objects filtered by the copyright column + * @method array findByDbLink(string $link) Return Podcast objects filtered by the link column * @method array findByDbItunesAuthor(string $itunes_author) Return Podcast objects filtered by the itunes_author column * @method array findByDbItunesKeywords(string $itunes_keywords) Return Podcast objects filtered by the itunes_keywords column * @method array findByDbItunesSummary(string $itunes_summary) Return Podcast objects filtered by the itunes_summary column * @method array findByDbItunesSubtitle(string $itunes_subtitle) Return Podcast objects filtered by the itunes_subtitle column * @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 findByDbAutoIngest(boolean $auto_ingest) Return Podcast objects filtered by the auto_ingest column * @method array findByDbOwner(int $owner) Return Podcast objects filtered by the owner column - * @method array findByDbType(int $type) Return Podcast objects filtered by the type column + * @method array findByDescendantClass(string $descendant_class) Return Podcast objects filtered by the descendant_class column * * @package propel.generator.airtime.om */ @@ -194,7 +198,7 @@ abstract class BasePodcastQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "url", "title", "creator", "description", "language", "copyright", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "auto_ingest", "owner", "type" 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", "descendant_class" FROM "podcast" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -325,35 +329,6 @@ abstract class BasePodcastQuery extends ModelCriteria return $this->addUsingAlias(PodcastPeer::ID, $dbId, $comparison); } - /** - * Filter the query on the url column - * - * Example usage: - * - * $query->filterByDbUrl('fooValue'); // WHERE url = 'fooValue' - * $query->filterByDbUrl('%fooValue%'); // WHERE url LIKE '%fooValue%' - * - * - * @param string $dbUrl The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return PodcastQuery The current query, for fluid interface - */ - public function filterByDbUrl($dbUrl = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbUrl)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbUrl)) { - $dbUrl = str_replace('*', '%', $dbUrl); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(PodcastPeer::URL, $dbUrl, $comparison); - } - /** * Filter the query on the title column * @@ -499,6 +474,35 @@ abstract class BasePodcastQuery extends ModelCriteria return $this->addUsingAlias(PodcastPeer::COPYRIGHT, $dbCopyright, $comparison); } + /** + * Filter the query on the link column + * + * Example usage: + * + * $query->filterByDbLink('fooValue'); // WHERE link = 'fooValue' + * $query->filterByDbLink('%fooValue%'); // WHERE link LIKE '%fooValue%' + * + * + * @param string $dbLink The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastQuery The current query, for fluid interface + */ + public function filterByDbLink($dbLink = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLink)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLink)) { + $dbLink = str_replace('*', '%', $dbLink); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(PodcastPeer::LINK, $dbLink, $comparison); + } + /** * Filter the query on the itunes_author column * @@ -673,33 +677,6 @@ abstract class BasePodcastQuery extends ModelCriteria return $this->addUsingAlias(PodcastPeer::ITUNES_EXPLICIT, $dbItunesExplicit, $comparison); } - /** - * Filter the query on the auto_ingest column - * - * Example usage: - * - * $query->filterByDbAutoIngest(true); // WHERE auto_ingest = true - * $query->filterByDbAutoIngest('yes'); // WHERE auto_ingest = true - * - * - * @param boolean|string $dbAutoIngest The value to use as filter. - * Non-boolean arguments are converted using the following rules: - * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true - * * 0, '0', 'false', 'off', and 'no' are converted to boolean false - * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return PodcastQuery The current query, for fluid interface - */ - public function filterByDbAutoIngest($dbAutoIngest = null, $comparison = null) - { - if (is_string($dbAutoIngest)) { - $dbAutoIngest = in_array(strtolower($dbAutoIngest), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; - } - - return $this->addUsingAlias(PodcastPeer::AUTO_INGEST, $dbAutoIngest, $comparison); - } - /** * Filter the query on the owner column * @@ -745,45 +722,32 @@ abstract class BasePodcastQuery extends ModelCriteria } /** - * Filter the query on the type column + * Filter the query on the descendant_class column * * Example usage: * - * $query->filterByDbType(1234); // WHERE type = 1234 - * $query->filterByDbType(array(12, 34)); // WHERE type IN (12, 34) - * $query->filterByDbType(array('min' => 12)); // WHERE type >= 12 - * $query->filterByDbType(array('max' => 12)); // WHERE type <= 12 + * $query->filterByDescendantClass('fooValue'); // WHERE descendant_class = 'fooValue' + * $query->filterByDescendantClass('%fooValue%'); // WHERE descendant_class LIKE '%fooValue%' * * - * @param mixed $dbType The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $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 filterByDbType($dbType = null, $comparison = null) + public function filterByDescendantClass($descendantClass = null, $comparison = null) { - if (is_array($dbType)) { - $useMinMax = false; - if (isset($dbType['min'])) { - $this->addUsingAlias(PodcastPeer::TYPE, $dbType['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbType['max'])) { - $this->addUsingAlias(PodcastPeer::TYPE, $dbType['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { + 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::TYPE, $dbType, $comparison); + return $this->addUsingAlias(PodcastPeer::DESCENDANT_CLASS, $descendantClass, $comparison); } /** @@ -936,6 +900,154 @@ 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 new file mode 100644 index 000000000..82d101d73 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcast.php @@ -0,0 +1,1751 @@ +id; + } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getDbTitle() + { + + return $this->title; + } + + /** + * Get the [creator] column value. + * + * @return string + */ + public function getDbCreator() + { + + return $this->creator; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDbDescription() + { + + return $this->description; + } + + /** + * Get the [language] column value. + * + * @return string + */ + public function getDbLanguage() + { + + return $this->language; + } + + /** + * Get the [copyright] column value. + * + * @return string + */ + public function getDbCopyright() + { + + return $this->copyright; + } + + /** + * Get the [link] column value. + * + * @return string + */ + public function getDbLink() + { + + return $this->link; + } + + /** + * Get the [itunes_author] column value. + * + * @return string + */ + public function getDbItunesAuthor() + { + + return $this->itunes_author; + } + + /** + * Get the [itunes_keywords] column value. + * + * @return string + */ + public function getDbItunesKeywords() + { + + return $this->itunes_keywords; + } + + /** + * Get the [itunes_summary] column value. + * + * @return string + */ + public function getDbItunesSummary() + { + + return $this->itunes_summary; + } + + /** + * Get the [itunes_subtitle] column value. + * + * @return string + */ + public function getDbItunesSubtitle() + { + + return $this->itunes_subtitle; + } + + /** + * Get the [itunes_category] column value. + * + * @return string + */ + public function getDbItunesCategory() + { + + return $this->itunes_category; + } + + /** + * Get the [itunes_explicit] column value. + * + * @return string + */ + public function getDbItunesExplicit() + { + + return $this->itunes_explicit; + } + + /** + * Get the [owner] column value. + * + * @return int + */ + public function getDbOwner() + { + + return $this->owner; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return StationPodcast The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = StationPodcastPeer::ID; + } + + 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() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return true + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which resultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->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->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + $this->postHydrate($row, $startcol, $rehydrate); + + return $startcol + 14; // 14 = StationPodcastPeer::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating StationPodcast object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aPodcast !== null && $this->id !== $this->aPodcast->getDbId()) { + $this->aPodcast = null; + } + if ($this->aCcSubjs !== null && $this->owner !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = StationPodcastPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aPodcast = null; + $this->aCcSubjs = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @throws Exception + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $deleteQuery = StationPodcastQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + // concrete_inheritance behavior + $this->getParentOrCreate($con)->delete($con); + + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @throws Exception + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + // concrete_inheritance behavior + $parent = $this->getSyncParent($con); + $parent->save($con); + $this->setPrimaryKey($parent->getPrimaryKey()); + + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + StationPodcastPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aPodcast !== null) { + if ($this->aPodcast->isModified() || $this->aPodcast->isNew()) { + $affectedRows += $this->aPodcast->save($con); + } + $this->setPodcast($this->aPodcast); + } + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param PropelPDO $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(PropelPDO $con) + { + $modifiedColumns = array(); + $index = 0; + + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(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"'; + } + + $sql = sprintf( + 'INSERT INTO "station_podcast" (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case '"id"': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case '"title"': + $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; + case '"creator"': + $stmt->bindValue($identifier, $this->creator, PDO::PARAM_STR); + break; + case '"description"': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; + case '"language"': + $stmt->bindValue($identifier, $this->language, PDO::PARAM_STR); + break; + case '"copyright"': + $stmt->bindValue($identifier, $this->copyright, PDO::PARAM_STR); + break; + case '"link"': + $stmt->bindValue($identifier, $this->link, PDO::PARAM_STR); + break; + case '"itunes_author"': + $stmt->bindValue($identifier, $this->itunes_author, PDO::PARAM_STR); + break; + case '"itunes_keywords"': + $stmt->bindValue($identifier, $this->itunes_keywords, PDO::PARAM_STR); + break; + case '"itunes_summary"': + $stmt->bindValue($identifier, $this->itunes_summary, PDO::PARAM_STR); + break; + case '"itunes_subtitle"': + $stmt->bindValue($identifier, $this->itunes_subtitle, PDO::PARAM_STR); + break; + case '"itunes_category"': + $stmt->bindValue($identifier, $this->itunes_category, PDO::PARAM_STR); + break; + case '"itunes_explicit"': + $stmt->bindValue($identifier, $this->itunes_explicit, PDO::PARAM_STR); + break; + case '"owner"': + $stmt->bindValue($identifier, $this->owner, PDO::PARAM_INT); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); + } + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param PropelPDO $con + * + * @see doSave() + */ + protected function doUpdate(PropelPDO $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con); + } + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + + return true; + } + + $this->validationFailures = $res; + + return false; + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggregated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aPodcast !== null) { + if (!$this->aPodcast->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aPodcast->getValidationFailures()); + } + } + + 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); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = StationPodcastPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->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(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['StationPodcast'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['StationPodcast'][$this->getPrimaryKey()] = true; + $keys = StationPodcastPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->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(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aPodcast) { + $result['Podcast'] = $this->aPodcast->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = StationPodcastPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + + $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->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); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's BasePeer::TYPE_PHPNAME + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = StationPodcastPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->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]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME); + + if ($this->isColumnModified(StationPodcastPeer::ID)) $criteria->add(StationPodcastPeer::ID, $this->id); + if ($this->isColumnModified(StationPodcastPeer::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); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME); + $criteria->add(StationPodcastPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of StationPodcast (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setDbTitle($this->getDbTitle()); + $copyObj->setDbCreator($this->getDbCreator()); + $copyObj->setDbDescription($this->getDbDescription()); + $copyObj->setDbLanguage($this->getDbLanguage()); + $copyObj->setDbCopyright($this->getDbCopyright()); + $copyObj->setDbLink($this->getDbLink()); + $copyObj->setDbItunesAuthor($this->getDbItunesAuthor()); + $copyObj->setDbItunesKeywords($this->getDbItunesKeywords()); + $copyObj->setDbItunesSummary($this->getDbItunesSummary()); + $copyObj->setDbItunesSubtitle($this->getDbItunesSubtitle()); + $copyObj->setDbItunesCategory($this->getDbItunesCategory()); + $copyObj->setDbItunesExplicit($this->getDbItunesExplicit()); + $copyObj->setDbOwner($this->getDbOwner()); + + if ($deepCopy && !$this->startCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + // store object hash to prevent cycle + $this->startCopy = true; + + $relObj = $this->getPodcast(); + if ($relObj) { + $copyObj->setPodcast($relObj->copy($deepCopy)); + } + + //unflag object copy + $this->startCopy = false; + } // if ($deepCopy) + + if ($makeNew) { + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return StationPodcast Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return StationPodcastPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new StationPodcastPeer(); + } + + return self::$peer; + } + + /** + * Declares an association between this object and a Podcast object. + * + * @param Podcast $v + * @return StationPodcast The current object (for fluent API support) + * @throws PropelException + */ + public function setPodcast(Podcast $v = null) + { + if ($v === null) { + $this->setDbId(NULL); + } else { + $this->setDbId($v->getDbId()); + } + + $this->aPodcast = $v; + + // Add binding for other direction of this 1:1 relationship. + if ($v !== null) { + $v->setStationPodcast($this); + } + + + return $this; + } + + + /** + * Get the associated Podcast object + * + * @param PropelPDO $con Optional Connection object. + * @param $doQuery Executes a query to get the object if required + * @return Podcast The associated Podcast object. + * @throws PropelException + */ + public function getPodcast(PropelPDO $con = null, $doQuery = true) + { + if ($this->aPodcast === null && ($this->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); + /* 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); + */ + } + + return $this->aCcSubjs; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + 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->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->alreadyInClearAllReferencesDeep = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep && !$this->alreadyInClearAllReferencesDeep) { + $this->alreadyInClearAllReferencesDeep = true; + if ($this->aPodcast instanceof Persistent) { + $this->aPodcast->clearAllReferences($deep); + } + if ($this->aCcSubjs instanceof Persistent) { + $this->aCcSubjs->clearAllReferences($deep); + } + + $this->alreadyInClearAllReferencesDeep = false; + } // if ($deep) + + $this->aPodcast = null; + $this->aCcSubjs = null; + } + + /** + * return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(StationPodcastPeer::DEFAULT_STRING_FORMAT); + } + + /** + * return true is the object is in saving state + * + * @return boolean + */ + public function isAlreadyInSave() + { + return $this->alreadyInSave; + } + + // concrete_inheritance behavior + + /** + * Get or Create the parent Podcast object of the current object + * + * @return Podcast The parent object + */ + public function getParentOrCreate($con = null) + { + 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'); + } + + return $parent; + } + } + + 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; + } + +} diff --git a/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php new file mode 100644 index 000000000..2eb030911 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcastPeer.php @@ -0,0 +1,1449 @@ + 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, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. StationPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, '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, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + public static function translateFieldName($name, $fromType, $toType) + { + $toNames = StationPodcastPeer::getFieldNames($toType); + $key = isset(StationPodcastPeer::$fieldKeys[$fromType][$name]) ? StationPodcastPeer::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(StationPodcastPeer::$fieldKeys[$fromType], true)); + } + + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + * @throws PropelException - if the type is not valid. + */ + public static function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, StationPodcastPeer::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + + return StationPodcastPeer::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. StationPodcastPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(StationPodcastPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(StationPodcastPeer::ID); + $criteria->addSelectColumn(StationPodcastPeer::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); + } 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'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + StationPodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + + return $count; + } + /** + * Selects one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return StationPodcast + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = StationPodcastPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + + return null; + } + /** + * Selects several row from the DB. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return StationPodcastPeer::populateObjects(StationPodcastPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement directly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + StationPodcastPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param StationPodcast $obj A StationPodcast object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool($obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + StationPodcastPeer::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A StationPodcast object or a primary key value. + * + * @return void + * @throws PropelException - if the value is invalid. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof StationPodcast) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or StationPodcast object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(StationPodcastPeer::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return StationPodcast Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(StationPodcastPeer::$instances[$key])) { + return StationPodcastPeer::$instances[$key]; + } + } + + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool($and_clear_all_references = false) + { + if ($and_clear_all_references) { + foreach (StationPodcastPeer::$instances as $instance) { + $instance->clearAllReferences(true); + } + } + StationPodcastPeer::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to station_podcast + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or null if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return null. + if ($row[$startcol] === null) { + return null; + } + + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = StationPodcastPeer::getOMClass(); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = StationPodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = StationPodcastPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + StationPodcastPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (StationPodcast object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = StationPodcastPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = StationPodcastPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + StationPodcastPeer::NUM_HYDRATE_COLUMNS; + } else { + $cls = StationPodcastPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + StationPodcastPeer::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + + /** + * Returns the number of rows matching criteria, joining the related Podcast table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinPodcast(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + StationPodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(StationPodcastPeer::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); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + + return $count; + } + + + /** + * Selects a collection of StationPodcast objects pre-filled with their Podcast objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of StationPodcast objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinPodcast(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + } + + StationPodcastPeer::addSelectColumns($criteria); + $startcol = StationPodcastPeer::NUM_HYDRATE_COLUMNS; + PodcastPeer::addSelectColumns($criteria); + + $criteria->addJoin(StationPodcastPeer::ID, PodcastPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = StationPodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = StationPodcastPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = StationPodcastPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + StationPodcastPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = PodcastPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = PodcastPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + PodcastPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (StationPodcast) to $obj2 (Podcast) + // 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 + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + StationPodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(StationPodcastPeer::ID, PodcastPeer::ID, $join_behavior); + + $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; + } + + /** + * Selects a collection of StationPodcast objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of StationPodcast objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + } + + StationPodcastPeer::addSelectColumns($criteria); + $startcol2 = StationPodcastPeer::NUM_HYDRATE_COLUMNS; + + PodcastPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS; + + 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); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = StationPodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = StationPodcastPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = StationPodcastPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + StationPodcastPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined Podcast rows + + $key2 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = PodcastPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = PodcastPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + PodcastPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (StationPodcast) to the collection in $obj2 (Podcast) + $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 + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(StationPodcastPeer::DATABASE_NAME)->getTable(StationPodcastPeer::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseStationPodcastPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseStationPodcastPeer::TABLE_NAME)) { + $dbMap->addTableObject(new \StationPodcastTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * + * @return string ClassName + */ + public static function getOMClass($row = 0, $colnum = 0) + { + return StationPodcastPeer::OM_CLASS; + } + + /** + * Performs an INSERT on the database, given a StationPodcast or Criteria object. + * + * @param mixed $values Criteria or StationPodcast object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from StationPodcast object + } + + + // Set the correct dbName + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Performs an UPDATE on the database, given a StationPodcast or Criteria object. + * + * @param mixed $values Criteria or StationPodcast object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(StationPodcastPeer::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(StationPodcastPeer::ID); + $value = $criteria->remove(StationPodcastPeer::ID); + if ($value) { + $selectCriteria->add(StationPodcastPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(StationPodcastPeer::TABLE_NAME); + } + + } else { // $values is StationPodcast object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Deletes all rows from the station_podcast table. + * + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException + */ + public static function doDeleteAll(PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(StationPodcastPeer::TABLE_NAME, $con, StationPodcastPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + StationPodcastPeer::clearInstancePool(); + StationPodcastPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs a DELETE on the database, given a StationPodcast or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or StationPodcast object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + StationPodcastPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof StationPodcast) { // it's a model object + // invalidate the cache for this single object + StationPodcastPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME); + $criteria->add(StationPodcastPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + StationPodcastPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(StationPodcastPeer::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + StationPodcastPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given StationPodcast object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param StationPodcast $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate($obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(StationPodcastPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(StationPodcastPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->hasColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(StationPodcastPeer::DATABASE_NAME, StationPodcastPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return StationPodcast + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = StationPodcastPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME); + $criteria->add(StationPodcastPeer::ID, $pk); + + $v = StationPodcastPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @return StationPodcast[] + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(StationPodcastPeer::DATABASE_NAME); + $criteria->add(StationPodcastPeer::ID, $pks, Criteria::IN); + $objs = StationPodcastPeer::doSelect($criteria, $con); + } + + return $objs; + } + +} // BaseStationPodcastPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseStationPodcastPeer::buildTableMap(); + diff --git a/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php new file mode 100644 index 000000000..fcf9aaa38 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseStationPodcastQuery.php @@ -0,0 +1,882 @@ +mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return StationPodcast|StationPodcast[]|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = StationPodcastPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getConnection(StationPodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Alias of findPk to use instance pooling + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con A connection object + * + * @return StationPodcast A model object, or null if the key is not found + * @throws PropelException + */ + public function findOneByDbId($key, $con = null) + { + return $this->findPk($key, $con); + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con A connection object + * + * @return StationPodcast A model object, or null if the key is not found + * @throws PropelException + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT "id", "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'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key, PDO::PARAM_INT); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); + } + $obj = null; + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $obj = new StationPodcast(); + $obj->hydrate($row); + StationPodcastPeer::addInstanceToPool($obj, (string) $key); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con A connection object + * + * @return StationPodcast|StationPodcast[]|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|StationPodcast[]|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if ($con === null) { + $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($stmt); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return StationPodcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(StationPodcastPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return StationPodcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(StationPodcastPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterByDbId(1234); // WHERE id = 1234 + * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12 + * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12 + * + * + * @see filterByPodcast() + * + * @param mixed $dbId The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return StationPodcastQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId)) { + $useMinMax = false; + if (isset($dbId['min'])) { + $this->addUsingAlias(StationPodcastPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbId['max'])) { + $this->addUsingAlias(StationPodcastPeer::ID, $dbId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(StationPodcastPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the 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 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. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return StationPodcastQuery The current query, for fluid interface + */ + public function filterByDbOwner($dbOwner = null, $comparison = null) + { + if (is_array($dbOwner)) { + $useMinMax = false; + if (isset($dbOwner['min'])) { + $this->addUsingAlias(StationPodcastPeer::OWNER, $dbOwner['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbOwner['max'])) { + $this->addUsingAlias(StationPodcastPeer::OWNER, $dbOwner['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(StationPodcastPeer::OWNER, $dbOwner, $comparison); + } + + /** + * Filter the query by a related Podcast object + * + * @param Podcast|PropelObjectCollection $podcast The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return StationPodcastQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByPodcast($podcast, $comparison = null) + { + if ($podcast instanceof Podcast) { + return $this + ->addUsingAlias(StationPodcastPeer::ID, $podcast->getDbId(), $comparison); + } elseif ($podcast instanceof PropelObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(StationPodcastPeer::ID, $podcast->toKeyValue('PrimaryKey', 'DbId'), $comparison); + } else { + throw new PropelException('filterByPodcast() only accepts arguments of type Podcast or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the Podcast relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return StationPodcastQuery The current query, for fluid interface + */ + public function joinPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Podcast'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Podcast'); + } + + return $this; + } + + /** + * Use the Podcast relation Podcast object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return PodcastQuery A secondary query class using the current class as primary query + */ + public function usePodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinPodcast($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Podcast', 'PodcastQuery'); + } + + /** + * 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 + * + * @param StationPodcast $stationPodcast Object to remove from the list of results + * + * @return StationPodcastQuery The current query, for fluid interface + */ + public function prune($stationPodcast = null) + { + if ($stationPodcast) { + $this->addUsingAlias(StationPodcastPeer::ID, $stationPodcast->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} diff --git a/airtime_mvc/application/modules/rest/controllers/PodcastController.php b/airtime_mvc/application/modules/rest/controllers/PodcastController.php index 138da8c3c..46e0b37f1 100644 --- a/airtime_mvc/application/modules/rest/controllers/PodcastController.php +++ b/airtime_mvc/application/modules/rest/controllers/PodcastController.php @@ -81,7 +81,7 @@ class Rest_PodcastController extends Zend_Rest_Controller } try { - // $requestData = json_decode($this->getRequest()->getRawBody(), true); + //$requestData = json_decode($this->getRequest()->getRawBody(), true); $requestData = $this->getRequest()->getPost(); $podcast = Podcast::create($requestData); diff --git a/airtime_mvc/application/modules/rest/controllers/PodcastEpisodesController.php b/airtime_mvc/application/modules/rest/controllers/PodcastEpisodesController.php index ee9d00d2e..605bbb521 100644 --- a/airtime_mvc/application/modules/rest/controllers/PodcastEpisodesController.php +++ b/airtime_mvc/application/modules/rest/controllers/PodcastEpisodesController.php @@ -79,8 +79,8 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller } try { - //$requestData = json_decode($this->getRequest()->getRawBody(), true); - $requestData = $this->getRequest()->getPost(); + $requestData = json_decode($this->getRequest()->getRawBody(), true); + //$requestData = $this->getRequest()->getPost(); $episode = PodcastEpisodes::create($id, $requestData); @@ -125,7 +125,7 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller public function putAction() { - + } private function getId() diff --git a/airtime_mvc/application/services/PodcastService.php b/airtime_mvc/application/services/PodcastService.php index 33ebd4949..9ff9b340b 100644 --- a/airtime_mvc/application/services/PodcastService.php +++ b/airtime_mvc/application/services/PodcastService.php @@ -61,9 +61,101 @@ class Application_Service_PodcastService extends Application_Service_ThirdPartyC } } - public static function getPodcastEpisodeFeed($podcast) + public static function createStationRssFeed() { + //TODO: get station feed podcast ID + //hack + $id = 1; + try { + $podcast = PodcastQuery::create()->findPk($id); + if (!$podcast) { + throw new PodcastNotFoundException(); + } + + $xml = new SimpleXMLElement(''); + + $channel = $xml->addChild("channel"); + $channel->addChild("title", $podcast->getDbTitle()); + $channel->addChild("link", $podcast->getDbLink()); + $channel->addChild("description", $podcast->getDbDescription()); + $channel->addChild("language", $podcast->getDbLanguage()); + $channel->addChild("copyright", $podcast->getDbCopyright()); + + $imageUrl = Application_Common_HTTPHelper::getStationUrl()."images/airtime_logo.png"; + $image = $channel->addChild("image"); + $image->addChild("title", "image title"); + $image->addChild("url", $imageUrl); + $image->addChild("link", Application_Common_HTTPHelper::getStationUrl()); + + $xml->addAttribute('xmlns:xmlns:itunes', ITUNES_XML_NAMESPACE_URL); + $channel->addChild("xmlns:itunes:author", $podcast->getDbItunesAuthor()); + $channel->addChild("xmlns:itunes:keywords", $podcast->getDbItunesKeywords()); + $channel->addChild("xmlns:itunes:summary", $podcast->getDbItunesSummary()); + $channel->addChild("xmlns:itunes:subtitle", $podcast->getDbItunesSubtitle()); + $channel->addChild("xmlns:itunes:explicit", $podcast->getDbItunesExplicit()); + + $itunesImage = $channel->addChild("xmlns:itunes:image"); + $itunesImage->addAttribute("href", $imageUrl); + + // Need to split categories into separate tags + $itunesCategories = explode(",", $podcast->getDbItunesCategory()); + foreach ($itunesCategories as $c) { + $category = $channel->addChild("xmlns:itunes:category"); + $category->addAttribute("text", $c); + } + + $episodes = PodcastEpisodesQuery::create()->filterByDbPodcastId($id)->find(); + foreach ($episodes as $episode) { + $item = $channel->addChild("item"); + $publishedFile = CcFilesQuery::create()->findPk($episode->getDbFileId()); + + //title + $item->addChild("title", $publishedFile->getDbTrackTitle()); + + //link - do we need this? + + //pubDate + $item->addChild("pubDate", $episode->getDbPublicationDate()); + + //category + foreach($itunesCategories as $c) { + $item->addChild("category", $c); + } + + //guid + $guid = $item->addChild("guid", $episode->getDbEpisodeGuid()); + $guid->addAttribute("isPermaLink", "false"); + + //description + $item->addChild("description", $publishedFile->getDbDescription()); + + //encolsure - url, length, type attribs + $enclosure = $item->addChild("enclosure"); + $enclosure->addAttribute("url", $episode->getDbDownloadUrl()); + $enclosure->addAttribute("length", Application_Common_DateHelper::calculateLengthInSeconds($publishedFile->getDbLength())); + $enclosure->addAttribute("type", $publishedFile->getDbMime()); + + //itunes:subtitle + $item->addChild("xmlns:itunes:subtitle", $publishedFile->getDbTrackTitle()); + + //itunes:summary + $item->addChild("xmlns:itunes:summary", $publishedFile->getDbDescription()); + + //itunes:author + $item->addChild("xmlns:itunes:author", $publishedFile->getDbArtistName()); + + //itunes:explicit - skip this? + + //itunes:duration + $item->addChild("xmlns:itunes:duration", $publishedFile->getDbLength()); + } + + return $xml->asXML(); + + } catch (FeedException $e) { + return false; + } } /** diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 8bc4d3cab..0f12a6a81 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -563,28 +563,40 @@ - +
- + - -
+ + + + +
+ + + + + + + +
+ diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index 058c960d2..18772939c 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -716,21 +716,72 @@ DROP TABLE IF EXISTS "podcast" CASCADE; CREATE TABLE "podcast" ( "id" serial NOT NULL, - "url" VARCHAR(4096) NOT NULL, "title" VARCHAR(4096) NOT NULL, "creator" VARCHAR(4096), "description" VARCHAR(4096), "language" VARCHAR(4096), "copyright" VARCHAR(4096), + "link" VARCHAR(4096), + "itunes_author" VARCHAR(4096), + "itunes_keywords" VARCHAR(4096), + "itunes_summary" VARCHAR(4096), + "itunes_subtitle" VARCHAR(4096), + "itunes_category" VARCHAR(4096), + "itunes_explicit" VARCHAR(4096), + "owner" INTEGER, + "descendant_class" VARCHAR(100), + PRIMARY KEY ("id") +); + +----------------------------------------------------------------------- +-- station_podcast +----------------------------------------------------------------------- + +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, + PRIMARY KEY ("id") +); + +----------------------------------------------------------------------- +-- imported_podcast +----------------------------------------------------------------------- + +DROP TABLE IF EXISTS "imported_podcast" CASCADE; + +CREATE TABLE "imported_podcast" +( + "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), - "auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL, "owner" INTEGER, - "type" INTEGER DEFAULT 1 NOT NULL, PRIMARY KEY ("id") ); @@ -928,6 +979,26 @@ 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") + 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") + 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")