diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index d49260157..a7151202f 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -1507,7 +1507,18 @@ class Application_Model_Preference return self::getValue("podcast_poll_lock"); } - public static function setPodcastPollLock($value) { + public static function setPodcastPollLock($value) + { self::setValue("podcast_poll_lock", $value); } + + public static function getStationPodcastId() + { + return self::getValue("station_podcast_id"); + } + + public static function setStationPodcastId($value) + { + self::setValue("station_podcast_id", $value); + } } diff --git a/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php b/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php index ff39487df..820a05539 100644 --- a/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php +++ b/airtime_mvc/application/models/airtime/map/ImportedPodcastTableMap.php @@ -40,7 +40,6 @@ class ImportedPodcastTableMap extends TableMap $this->setPrimaryKeyMethodInfo('imported_podcast_id_seq'); // columns $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); - $this->addColumn('url', 'DbUrl', 'VARCHAR', true, 4096, null); $this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false); $this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null); // validators diff --git a/airtime_mvc/application/models/airtime/map/PodcastTableMap.php b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php index 9ae7565df..f5b0789c1 100644 --- a/airtime_mvc/application/models/airtime/map/PodcastTableMap.php +++ b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php @@ -40,6 +40,7 @@ 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); diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php index 44342dd99..21e84891b 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcast.php @@ -35,12 +35,6 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent */ protected $id; - /** - * The value for the url field. - * @var string - */ - protected $url; - /** * The value for the auto_ingest field. * Note: this column has a database default value of: false @@ -111,17 +105,6 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent return $this->id; } - /** - * Get the [url] column value. - * - * @return string - */ - public function getDbUrl() - { - - return $this->url; - } - /** * Get the [auto_ingest] column value. * @@ -165,27 +148,6 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent return $this; } // setDbId() - /** - * 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: @@ -277,9 +239,8 @@ abstract class BaseImportedPodcast 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->auto_ingest = ($row[$startcol + 2] !== null) ? (boolean) $row[$startcol + 2] : null; - $this->podcast_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->auto_ingest = ($row[$startcol + 1] !== null) ? (boolean) $row[$startcol + 1] : null; + $this->podcast_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; $this->resetModified(); $this->setNew(false); @@ -289,7 +250,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 4; // 4 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 3; // 3 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating ImportedPodcast object", $e); @@ -530,9 +491,6 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent if ($this->isColumnModified(ImportedPodcastPeer::ID)) { $modifiedColumns[':p' . $index++] = '"id"'; } - if ($this->isColumnModified(ImportedPodcastPeer::URL)) { - $modifiedColumns[':p' . $index++] = '"url"'; - } if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) { $modifiedColumns[':p' . $index++] = '"auto_ingest"'; } @@ -553,9 +511,6 @@ abstract class BaseImportedPodcast 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 '"auto_ingest"': $stmt->bindValue($identifier, $this->auto_ingest, PDO::PARAM_BOOL); break; @@ -705,12 +660,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent return $this->getDbId(); break; case 1: - return $this->getDbUrl(); - break; - case 2: return $this->getDbAutoIngest(); break; - case 3: + case 2: return $this->getDbPodcastId(); break; default: @@ -743,9 +695,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $keys = ImportedPodcastPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getDbId(), - $keys[1] => $this->getDbUrl(), - $keys[2] => $this->getDbAutoIngest(), - $keys[3] => $this->getDbPodcastId(), + $keys[1] => $this->getDbAutoIngest(), + $keys[2] => $this->getDbPodcastId(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -794,12 +745,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $this->setDbId($value); break; case 1: - $this->setDbUrl($value); - break; - case 2: $this->setDbAutoIngest($value); break; - case 3: + case 2: $this->setDbPodcastId($value); break; } // switch() @@ -827,9 +775,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $keys = ImportedPodcastPeer::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->setDbAutoIngest($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbPodcastId($arr[$keys[3]]); + if (array_key_exists($keys[1], $arr)) $this->setDbAutoIngest($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbPodcastId($arr[$keys[2]]); } /** @@ -842,7 +789,6 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent $criteria = new Criteria(ImportedPodcastPeer::DATABASE_NAME); if ($this->isColumnModified(ImportedPodcastPeer::ID)) $criteria->add(ImportedPodcastPeer::ID, $this->id); - if ($this->isColumnModified(ImportedPodcastPeer::URL)) $criteria->add(ImportedPodcastPeer::URL, $this->url); if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST, $this->auto_ingest); if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) $criteria->add(ImportedPodcastPeer::PODCAST_ID, $this->podcast_id); @@ -908,7 +854,6 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setDbUrl($this->getDbUrl()); $copyObj->setDbAutoIngest($this->getDbAutoIngest()); $copyObj->setDbPodcastId($this->getDbPodcastId()); @@ -1027,7 +972,6 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent public function clear() { $this->id = null; - $this->url = null; $this->auto_ingest = null; $this->podcast_id = null; $this->alreadyInSave = false; diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php index 1c49a0082..9263b0a67 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastPeer.php @@ -24,20 +24,17 @@ abstract class BaseImportedPodcastPeer const TM_CLASS = 'ImportedPodcastTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 4; + const NUM_COLUMNS = 3; /** 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 = 4; + const NUM_HYDRATE_COLUMNS = 3; /** the column name for the id field */ const ID = 'imported_podcast.id'; - /** the column name for the url field */ - const URL = 'imported_podcast.url'; - /** the column name for the auto_ingest field */ const AUTO_INGEST = 'imported_podcast.auto_ingest'; @@ -63,12 +60,12 @@ abstract class BaseImportedPodcastPeer * e.g. ImportedPodcastPeer::$fieldNames[ImportedPodcastPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbUrl', 'DbAutoIngest', 'DbPodcastId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUrl', 'dbAutoIngest', 'dbPodcastId', ), - BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::URL, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::PODCAST_ID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'URL', 'AUTO_INGEST', 'PODCAST_ID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'url', 'auto_ingest', 'podcast_id', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbAutoIngest', 'DbPodcastId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbPodcastId', ), + BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::PODCAST_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'AUTO_INGEST', 'PODCAST_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'podcast_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) ); /** @@ -78,12 +75,12 @@ abstract class BaseImportedPodcastPeer * e.g. ImportedPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbUrl' => 1, 'DbAutoIngest' => 2, 'DbPodcastId' => 3, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUrl' => 1, 'dbAutoIngest' => 2, 'dbPodcastId' => 3, ), - BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::URL => 1, ImportedPodcastPeer::AUTO_INGEST => 2, ImportedPodcastPeer::PODCAST_ID => 3, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'URL' => 1, 'AUTO_INGEST' => 2, 'PODCAST_ID' => 3, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'url' => 1, 'auto_ingest' => 2, 'podcast_id' => 3, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbAutoIngest' => 1, 'DbPodcastId' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbAutoIngest' => 1, 'dbPodcastId' => 2, ), + BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::PODCAST_ID => 2, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'AUTO_INGEST' => 1, 'PODCAST_ID' => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'auto_ingest' => 1, 'podcast_id' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) ); /** @@ -158,12 +155,10 @@ abstract class BaseImportedPodcastPeer { if (null === $alias) { $criteria->addSelectColumn(ImportedPodcastPeer::ID); - $criteria->addSelectColumn(ImportedPodcastPeer::URL); $criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST); $criteria->addSelectColumn(ImportedPodcastPeer::PODCAST_ID); } else { $criteria->addSelectColumn($alias . '.id'); - $criteria->addSelectColumn($alias . '.url'); $criteria->addSelectColumn($alias . '.auto_ingest'); $criteria->addSelectColumn($alias . '.podcast_id'); } diff --git a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php index e76701798..d859e734f 100644 --- a/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseImportedPodcastQuery.php @@ -7,12 +7,10 @@ * * * @method ImportedPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column - * @method ImportedPodcastQuery orderByDbUrl($order = Criteria::ASC) Order by the url column * @method ImportedPodcastQuery orderByDbAutoIngest($order = Criteria::ASC) Order by the auto_ingest column * @method ImportedPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column * * @method ImportedPodcastQuery groupByDbId() Group by the id column - * @method ImportedPodcastQuery groupByDbUrl() Group by the url column * @method ImportedPodcastQuery groupByDbAutoIngest() Group by the auto_ingest column * @method ImportedPodcastQuery groupByDbPodcastId() Group by the podcast_id column * @@ -27,12 +25,10 @@ * @method ImportedPodcast findOne(PropelPDO $con = null) Return the first ImportedPodcast matching the query * @method ImportedPodcast findOneOrCreate(PropelPDO $con = null) Return the first ImportedPodcast matching the query, or a new ImportedPodcast object populated from the query conditions when no match is found * - * @method ImportedPodcast findOneByDbUrl(string $url) Return the first ImportedPodcast filtered by the url column * @method ImportedPodcast findOneByDbAutoIngest(boolean $auto_ingest) Return the first ImportedPodcast filtered by the auto_ingest column * @method ImportedPodcast findOneByDbPodcastId(int $podcast_id) Return the first ImportedPodcast filtered by the podcast_id column * * @method array findByDbId(int $id) Return ImportedPodcast objects filtered by the id column - * @method array findByDbUrl(string $url) Return ImportedPodcast objects filtered by the url column * @method array findByDbAutoIngest(boolean $auto_ingest) Return ImportedPodcast objects filtered by the auto_ingest column * @method array findByDbPodcastId(int $podcast_id) Return ImportedPodcast objects filtered by the podcast_id column * @@ -142,7 +138,7 @@ abstract class BaseImportedPodcastQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "url", "auto_ingest", "podcast_id" FROM "imported_podcast" WHERE "id" = :p0'; + $sql = 'SELECT "id", "auto_ingest", "podcast_id" FROM "imported_podcast" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -273,35 +269,6 @@ abstract class BaseImportedPodcastQuery extends ModelCriteria return $this->addUsingAlias(ImportedPodcastPeer::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 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 * diff --git a/airtime_mvc/application/models/airtime/om/BasePodcast.php b/airtime_mvc/application/models/airtime/om/BasePodcast.php index e66df36b5..8a866b717 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcast.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcast.php @@ -35,6 +35,12 @@ 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 @@ -185,6 +191,17 @@ 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. * @@ -349,6 +366,27 @@ 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. * @@ -659,19 +697,20 @@ abstract class BasePodcast extends BaseObject implements Persistent try { $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->title = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->creator = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->language = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->copyright = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->link = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->itunes_author = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->itunes_keywords = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->itunes_summary = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->itunes_subtitle = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->itunes_category = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; - $this->itunes_explicit = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; - $this->owner = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null; + $this->url = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->creator = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->language = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->copyright = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->link = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->itunes_author = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->itunes_keywords = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->itunes_summary = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->itunes_subtitle = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; + $this->itunes_category = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; + $this->itunes_explicit = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; + $this->owner = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; $this->resetModified(); $this->setNew(false); @@ -681,7 +720,7 @@ abstract class BasePodcast extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 14; // 14 = PodcastPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = PodcastPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating Podcast object", $e); @@ -979,6 +1018,9 @@ 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"'; } @@ -1032,6 +1074,9 @@ 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; @@ -1238,42 +1283,45 @@ abstract class BasePodcast extends BaseObject implements Persistent return $this->getDbId(); break; case 1: - return $this->getDbTitle(); + return $this->getDbUrl(); break; case 2: - return $this->getDbCreator(); + return $this->getDbTitle(); break; case 3: - return $this->getDbDescription(); + return $this->getDbCreator(); break; case 4: - return $this->getDbLanguage(); + return $this->getDbDescription(); break; case 5: - return $this->getDbCopyright(); + return $this->getDbLanguage(); break; case 6: - return $this->getDbLink(); + return $this->getDbCopyright(); break; case 7: - return $this->getDbItunesAuthor(); + return $this->getDbLink(); break; case 8: - return $this->getDbItunesKeywords(); + return $this->getDbItunesAuthor(); break; case 9: - return $this->getDbItunesSummary(); + return $this->getDbItunesKeywords(); break; case 10: - return $this->getDbItunesSubtitle(); + return $this->getDbItunesSummary(); break; case 11: - return $this->getDbItunesCategory(); + return $this->getDbItunesSubtitle(); break; case 12: - return $this->getDbItunesExplicit(); + return $this->getDbItunesCategory(); break; case 13: + return $this->getDbItunesExplicit(); + break; + case 14: return $this->getDbOwner(); break; default: @@ -1306,19 +1354,20 @@ abstract class BasePodcast extends BaseObject implements Persistent $keys = PodcastPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getDbId(), - $keys[1] => $this->getDbTitle(), - $keys[2] => $this->getDbCreator(), - $keys[3] => $this->getDbDescription(), - $keys[4] => $this->getDbLanguage(), - $keys[5] => $this->getDbCopyright(), - $keys[6] => $this->getDbLink(), - $keys[7] => $this->getDbItunesAuthor(), - $keys[8] => $this->getDbItunesKeywords(), - $keys[9] => $this->getDbItunesSummary(), - $keys[10] => $this->getDbItunesSubtitle(), - $keys[11] => $this->getDbItunesCategory(), - $keys[12] => $this->getDbItunesExplicit(), - $keys[13] => $this->getDbOwner(), + $keys[1] => $this->getDbUrl(), + $keys[2] => $this->getDbTitle(), + $keys[3] => $this->getDbCreator(), + $keys[4] => $this->getDbDescription(), + $keys[5] => $this->getDbLanguage(), + $keys[6] => $this->getDbCopyright(), + $keys[7] => $this->getDbLink(), + $keys[8] => $this->getDbItunesAuthor(), + $keys[9] => $this->getDbItunesKeywords(), + $keys[10] => $this->getDbItunesSummary(), + $keys[11] => $this->getDbItunesSubtitle(), + $keys[12] => $this->getDbItunesCategory(), + $keys[13] => $this->getDbItunesExplicit(), + $keys[14] => $this->getDbOwner(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1376,42 +1425,45 @@ abstract class BasePodcast extends BaseObject implements Persistent $this->setDbId($value); break; case 1: - $this->setDbTitle($value); + $this->setDbUrl($value); break; case 2: - $this->setDbCreator($value); + $this->setDbTitle($value); break; case 3: - $this->setDbDescription($value); + $this->setDbCreator($value); break; case 4: - $this->setDbLanguage($value); + $this->setDbDescription($value); break; case 5: - $this->setDbCopyright($value); + $this->setDbLanguage($value); break; case 6: - $this->setDbLink($value); + $this->setDbCopyright($value); break; case 7: - $this->setDbItunesAuthor($value); + $this->setDbLink($value); break; case 8: - $this->setDbItunesKeywords($value); + $this->setDbItunesAuthor($value); break; case 9: - $this->setDbItunesSummary($value); + $this->setDbItunesKeywords($value); break; case 10: - $this->setDbItunesSubtitle($value); + $this->setDbItunesSummary($value); break; case 11: - $this->setDbItunesCategory($value); + $this->setDbItunesSubtitle($value); break; case 12: - $this->setDbItunesExplicit($value); + $this->setDbItunesCategory($value); break; case 13: + $this->setDbItunesExplicit($value); + break; + case 14: $this->setDbOwner($value); break; } // switch() @@ -1439,19 +1491,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->setDbTitle($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbCreator($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbDescription($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbLanguage($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbCopyright($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDbLink($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setDbItunesAuthor($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setDbItunesKeywords($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setDbItunesSummary($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setDbItunesSubtitle($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setDbItunesCategory($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setDbItunesExplicit($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setDbOwner($arr[$keys[13]]); + if (array_key_exists($keys[1], $arr)) $this->setDbUrl($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbTitle($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbCreator($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbDescription($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbLanguage($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbCopyright($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbLink($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbItunesAuthor($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbItunesKeywords($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbItunesSummary($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setDbItunesSubtitle($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setDbItunesCategory($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setDbItunesExplicit($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setDbOwner($arr[$keys[14]]); } /** @@ -1464,6 +1517,7 @@ 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); @@ -1540,6 +1594,7 @@ 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()); @@ -2409,6 +2464,7 @@ abstract class BasePodcast extends BaseObject implements Persistent public function clear() { $this->id = null; + $this->url = null; $this->title = null; $this->creator = null; $this->description = null; diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php index e4ee23dc9..5bf6d4a6b 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php @@ -24,17 +24,20 @@ abstract class BasePodcastPeer const TM_CLASS = 'PodcastTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 14; + 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 = 14; + 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'; @@ -93,12 +96,12 @@ abstract class BasePodcastPeer * e.g. PodcastPeer::$fieldNames[PodcastPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbLink', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbOwner', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbLink', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbOwner', ), - BasePeer::TYPE_COLNAME => array (PodcastPeer::ID, PodcastPeer::TITLE, PodcastPeer::CREATOR, PodcastPeer::DESCRIPTION, PodcastPeer::LANGUAGE, PodcastPeer::COPYRIGHT, PodcastPeer::LINK, PodcastPeer::ITUNES_AUTHOR, PodcastPeer::ITUNES_KEYWORDS, PodcastPeer::ITUNES_SUMMARY, PodcastPeer::ITUNES_SUBTITLE, PodcastPeer::ITUNES_CATEGORY, PodcastPeer::ITUNES_EXPLICIT, PodcastPeer::OWNER, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'LINK', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'OWNER', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'title', 'creator', 'description', 'language', 'copyright', 'link', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'owner', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbUrl', 'DbTitle', 'DbCreator', 'DbDescription', 'DbLanguage', 'DbCopyright', 'DbLink', 'DbItunesAuthor', 'DbItunesKeywords', 'DbItunesSummary', 'DbItunesSubtitle', 'DbItunesCategory', 'DbItunesExplicit', 'DbOwner', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUrl', 'dbTitle', 'dbCreator', 'dbDescription', 'dbLanguage', 'dbCopyright', 'dbLink', 'dbItunesAuthor', 'dbItunesKeywords', 'dbItunesSummary', 'dbItunesSubtitle', 'dbItunesCategory', 'dbItunesExplicit', 'dbOwner', ), + BasePeer::TYPE_COLNAME => array (PodcastPeer::ID, PodcastPeer::URL, PodcastPeer::TITLE, PodcastPeer::CREATOR, PodcastPeer::DESCRIPTION, PodcastPeer::LANGUAGE, PodcastPeer::COPYRIGHT, PodcastPeer::LINK, PodcastPeer::ITUNES_AUTHOR, PodcastPeer::ITUNES_KEYWORDS, PodcastPeer::ITUNES_SUMMARY, PodcastPeer::ITUNES_SUBTITLE, PodcastPeer::ITUNES_CATEGORY, PodcastPeer::ITUNES_EXPLICIT, PodcastPeer::OWNER, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'URL', 'TITLE', 'CREATOR', 'DESCRIPTION', 'LANGUAGE', 'COPYRIGHT', 'LINK', 'ITUNES_AUTHOR', 'ITUNES_KEYWORDS', 'ITUNES_SUMMARY', 'ITUNES_SUBTITLE', 'ITUNES_CATEGORY', 'ITUNES_EXPLICIT', 'OWNER', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'url', 'title', 'creator', 'description', 'language', 'copyright', 'link', 'itunes_author', 'itunes_keywords', 'itunes_summary', 'itunes_subtitle', 'itunes_category', 'itunes_explicit', 'owner', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -108,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, 'DbTitle' => 1, 'DbCreator' => 2, 'DbDescription' => 3, 'DbLanguage' => 4, 'DbCopyright' => 5, 'DbLink' => 6, 'DbItunesAuthor' => 7, 'DbItunesKeywords' => 8, 'DbItunesSummary' => 9, 'DbItunesSubtitle' => 10, 'DbItunesCategory' => 11, 'DbItunesExplicit' => 12, 'DbOwner' => 13, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTitle' => 1, 'dbCreator' => 2, 'dbDescription' => 3, 'dbLanguage' => 4, 'dbCopyright' => 5, 'dbLink' => 6, 'dbItunesAuthor' => 7, 'dbItunesKeywords' => 8, 'dbItunesSummary' => 9, 'dbItunesSubtitle' => 10, 'dbItunesCategory' => 11, 'dbItunesExplicit' => 12, 'dbOwner' => 13, ), - BasePeer::TYPE_COLNAME => array (PodcastPeer::ID => 0, PodcastPeer::TITLE => 1, PodcastPeer::CREATOR => 2, PodcastPeer::DESCRIPTION => 3, PodcastPeer::LANGUAGE => 4, PodcastPeer::COPYRIGHT => 5, PodcastPeer::LINK => 6, PodcastPeer::ITUNES_AUTHOR => 7, PodcastPeer::ITUNES_KEYWORDS => 8, PodcastPeer::ITUNES_SUMMARY => 9, PodcastPeer::ITUNES_SUBTITLE => 10, PodcastPeer::ITUNES_CATEGORY => 11, PodcastPeer::ITUNES_EXPLICIT => 12, PodcastPeer::OWNER => 13, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TITLE' => 1, 'CREATOR' => 2, 'DESCRIPTION' => 3, 'LANGUAGE' => 4, 'COPYRIGHT' => 5, 'LINK' => 6, 'ITUNES_AUTHOR' => 7, 'ITUNES_KEYWORDS' => 8, 'ITUNES_SUMMARY' => 9, 'ITUNES_SUBTITLE' => 10, 'ITUNES_CATEGORY' => 11, 'ITUNES_EXPLICIT' => 12, 'OWNER' => 13, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'title' => 1, 'creator' => 2, 'description' => 3, 'language' => 4, 'copyright' => 5, 'link' => 6, 'itunes_author' => 7, 'itunes_keywords' => 8, 'itunes_summary' => 9, 'itunes_subtitle' => 10, 'itunes_category' => 11, 'itunes_explicit' => 12, 'owner' => 13, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbUrl' => 1, 'DbTitle' => 2, 'DbCreator' => 3, 'DbDescription' => 4, 'DbLanguage' => 5, 'DbCopyright' => 6, 'DbLink' => 7, 'DbItunesAuthor' => 8, 'DbItunesKeywords' => 9, 'DbItunesSummary' => 10, 'DbItunesSubtitle' => 11, 'DbItunesCategory' => 12, 'DbItunesExplicit' => 13, 'DbOwner' => 14, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUrl' => 1, 'dbTitle' => 2, 'dbCreator' => 3, 'dbDescription' => 4, 'dbLanguage' => 5, 'dbCopyright' => 6, 'dbLink' => 7, 'dbItunesAuthor' => 8, 'dbItunesKeywords' => 9, 'dbItunesSummary' => 10, 'dbItunesSubtitle' => 11, 'dbItunesCategory' => 12, 'dbItunesExplicit' => 13, 'dbOwner' => 14, ), + BasePeer::TYPE_COLNAME => array (PodcastPeer::ID => 0, PodcastPeer::URL => 1, PodcastPeer::TITLE => 2, PodcastPeer::CREATOR => 3, PodcastPeer::DESCRIPTION => 4, PodcastPeer::LANGUAGE => 5, PodcastPeer::COPYRIGHT => 6, PodcastPeer::LINK => 7, PodcastPeer::ITUNES_AUTHOR => 8, PodcastPeer::ITUNES_KEYWORDS => 9, PodcastPeer::ITUNES_SUMMARY => 10, PodcastPeer::ITUNES_SUBTITLE => 11, PodcastPeer::ITUNES_CATEGORY => 12, PodcastPeer::ITUNES_EXPLICIT => 13, PodcastPeer::OWNER => 14, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'URL' => 1, 'TITLE' => 2, 'CREATOR' => 3, 'DESCRIPTION' => 4, 'LANGUAGE' => 5, 'COPYRIGHT' => 6, 'LINK' => 7, 'ITUNES_AUTHOR' => 8, 'ITUNES_KEYWORDS' => 9, 'ITUNES_SUMMARY' => 10, 'ITUNES_SUBTITLE' => 11, 'ITUNES_CATEGORY' => 12, 'ITUNES_EXPLICIT' => 13, 'OWNER' => 14, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'url' => 1, 'title' => 2, 'creator' => 3, 'description' => 4, 'language' => 5, 'copyright' => 6, 'link' => 7, 'itunes_author' => 8, 'itunes_keywords' => 9, 'itunes_summary' => 10, 'itunes_subtitle' => 11, 'itunes_category' => 12, 'itunes_explicit' => 13, 'owner' => 14, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -188,6 +191,7 @@ 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); @@ -203,6 +207,7 @@ abstract class BasePodcastPeer $criteria->addSelectColumn(PodcastPeer::OWNER); } else { $criteria->addSelectColumn($alias . '.id'); + $criteria->addSelectColumn($alias . '.url'); $criteria->addSelectColumn($alias . '.title'); $criteria->addSelectColumn($alias . '.creator'); $criteria->addSelectColumn($alias . '.description'); diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php index 02e94cc58..250cab2b5 100644 --- a/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php +++ b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php @@ -7,6 +7,7 @@ * * * @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 @@ -22,6 +23,7 @@ * @method PodcastQuery orderByDbOwner($order = Criteria::ASC) Order by the owner 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 @@ -59,6 +61,7 @@ * @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 @@ -74,6 +77,7 @@ * @method Podcast findOneByDbOwner(int $owner) Return the first Podcast filtered by the owner 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 @@ -194,7 +198,7 @@ abstract class BasePodcastQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "title", "creator", "description", "language", "copyright", "link", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "owner" FROM "podcast" WHERE "id" = :p0'; + $sql = 'SELECT "id", "url", "title", "creator", "description", "language", "copyright", "link", "itunes_author", "itunes_keywords", "itunes_summary", "itunes_subtitle", "itunes_category", "itunes_explicit", "owner" FROM "podcast" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -325,6 +329,35 @@ 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 * diff --git a/airtime_mvc/application/services/PodcastEpisodeService.php b/airtime_mvc/application/services/PodcastEpisodeService.php index bbe23aa90..45ce09fe3 100644 --- a/airtime_mvc/application/services/PodcastEpisodeService.php +++ b/airtime_mvc/application/services/PodcastEpisodeService.php @@ -25,103 +25,6 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir self::DOWNLOAD => 'podcast-download' // TODO: rename this to ingest? ]; - 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; - } - } - /** * Given an array of episodes, store them in the database as placeholder objects until * they can be processed by Celery diff --git a/airtime_mvc/application/services/PodcastFactory.php b/airtime_mvc/application/services/PodcastFactory.php index 04fe28e3c..486ce5f56 100644 --- a/airtime_mvc/application/services/PodcastFactory.php +++ b/airtime_mvc/application/services/PodcastFactory.php @@ -5,6 +5,10 @@ class PodcastFactory public static function create($feedUrl) { // check if station podcast exists and if not, create one + $stationPodcastId = Application_Model_Preference::getStationPodcastId(); + if (empty($stationPodcastId)) { + Application_Service_PodcastService::createStationPodcast(); + } return Application_Service_PodcastService::createFromFeedUrl($feedUrl); } diff --git a/airtime_mvc/application/services/PodcastService.php b/airtime_mvc/application/services/PodcastService.php index 2dce275f6..4e553ed9d 100644 --- a/airtime_mvc/application/services/PodcastService.php +++ b/airtime_mvc/application/services/PodcastService.php @@ -81,13 +81,13 @@ class Application_Service_PodcastService $podcastArray = array(); $podcastArray["url"] = $feedUrl; - $podcastArray["title"] = $rss->get_title(); - $podcastArray["description"] = $rss->get_description(); - $podcastArray["link"] = $rss->get_link(); - $podcastArray["language"] = $rss->get_language(); - $podcastArray["copyright"] = $rss->get_copyright(); - $podcastArray["creator"] = $rss->get_author()->get_name(); - $podcastArray["category"] = $rss->get_categories(); + $podcastArray["title"] = htmlspecialchars($rss->get_title()); + $podcastArray["description"] = htmlspecialchars($rss->get_description()); + $podcastArray["link"] = htmlspecialchars($rss->get_link()); + $podcastArray["language"] = htmlspecialchars($rss->get_language()); + $podcastArray["copyright"] = htmlspecialchars($rss->get_copyright()); + $podcastArray["creator"] = htmlspecialchars($rss->get_author()->get_name()); + $podcastArray["category"] = htmlspecialchars($rss->get_categories()); //TODO: put in constants $itunesChannel = "http://www.itunes.com/dtds/podcast-1.0.dtd"; @@ -137,6 +137,30 @@ class Application_Service_PodcastService } } + public static function createStationPodcast() + { + $podcast = new Podcast(); + $podcast->setDbUrl(Application_Common_HTTPHelper::getStationUrl() . "feeds/station-rss"); + + $title = Application_Model_Preference::GetStationName(); + $title = empty($title) ? "My Station's Podcast" : $title; + $podcast->setDbTitle($title); + + $podcast->setDbDescription(Application_Model_Preference::GetStationDescription()); + $podcast->setDbLink(Application_Common_HTTPHelper::getStationUrl()); + $podcast->setDbLanguage(Application_Model_Preference::GetLocale()); + $podcast->setDbCreator(Application_Model_Preference::GetStationName()); + $podcast->setDbOwner(self::getOwnerId()); + $podcast->save(); + + $stationPodcast = new StationPodcast(); + $stationPodcast->setPodcast($podcast); + $stationPodcast->save(); + + Application_Model_Preference::setStationPodcastId($podcast->getDbId()); + + } + //TODO move this somewhere where it makes sense private static function getOwnerId() { @@ -239,17 +263,7 @@ class Application_Service_PodcastService throw new PodcastNotFoundException(); } - // Is it an imported podcast? - $importedPodcast = ImportedPodcastQuery::create()->filterByDbPodcastId($podcast->getDbId())->findOne(); - if (!is_null($importedPodcast)) { - - $rss = self::getPodcastFeed($importedPodcast->getDbUrl()); - if (!$rss) { - throw new InvalidPodcastException(); - } - } else { - //TODO: get station podcast - } + $rss = self::getPodcastFeed($podcast->getDbUrl()); return self::_generatePodcastArray($podcast, $rss); } @@ -266,6 +280,10 @@ class Application_Service_PodcastService $podcast = PodcastQuery::create()->findPk($podcastId); if ($podcast) { $podcast->delete(); + + if ($podcastId == Application_Model_Preference::getStationPodcastId()) { + Application_Model_Preference::setStationPodcastId(null); + } } else { throw new PodcastNotFoundException(); } @@ -302,4 +320,99 @@ class Application_Service_PodcastService unset($data[$key]); } } + + public static function createStationRssFeed() + { + $stationPodcastId = Application_Model_Preference::getStationPodcastId(); + + try { + $podcast = PodcastQuery::create()->findPk($stationPodcastId); + 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($stationPodcastId)->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; + } + } } \ No newline at end of file diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index a4458a812..e000a698b 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -565,6 +565,7 @@ + @@ -596,7 +597,6 @@
- diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index 96c4d2d95..08fae2e53 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -716,6 +716,7 @@ 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), @@ -754,7 +755,6 @@ DROP TABLE IF EXISTS "imported_podcast" CASCADE; CREATE TABLE "imported_podcast" ( "id" serial NOT NULL, - "url" VARCHAR(4096) NOT NULL, "auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL, "podcast_id" INTEGER NOT NULL, PRIMARY KEY ("id")