Add album_override field for imported_podcasts

This commit is contained in:
Lucas Bickel 2017-03-17 11:52:03 +01:00
parent 033e816015
commit a2eb4b2297
6 changed files with 128 additions and 19 deletions

View File

@ -42,6 +42,7 @@ class ImportedPodcastTableMap extends TableMap
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false);
$this->addColumn('auto_ingest_timestamp', 'DbAutoIngestTimestamp', 'TIMESTAMP', false, null, null);
$this->addColumn('album_override', 'DbAlbumOverride', 'BOOLEAN', true, null, false);
$this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null);
// validators
} // initialize()

View File

@ -48,6 +48,13 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
*/
protected $auto_ingest_timestamp;
/**
* The value for the album_override field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $album_override;
/**
* The value for the podcast_id field.
* @var int
@ -88,6 +95,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
public function applyDefaultValues()
{
$this->auto_ingest = false;
$this->album_override = false;
}
/**
@ -157,6 +165,17 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
}
/**
* Get the [album_override] column value.
*
* @return boolean
*/
public function getDbAlbumOverride()
{
return $this->album_override;
}
/**
* Get the [podcast_id] column value.
*
@ -241,6 +260,35 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
return $this;
} // setDbAutoIngestTimestamp()
/**
* Sets the value of the [album_override] 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 setDbAlbumOverride($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->album_override !== $v) {
$this->album_override = $v;
$this->modifiedColumns[] = ImportedPodcastPeer::ALBUM_OVERRIDE;
}
return $this;
} // setDbAlbumOverride()
/**
* Set the value of [podcast_id] column.
*
@ -280,6 +328,10 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
return false;
}
if ($this->album_override !== false) {
return false;
}
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -305,7 +357,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->auto_ingest = ($row[$startcol + 1] !== null) ? (boolean) $row[$startcol + 1] : null;
$this->auto_ingest_timestamp = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->podcast_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
$this->album_override = ($row[$startcol + 3] !== null) ? (boolean) $row[$startcol + 3] : null;
$this->podcast_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
$this->resetModified();
$this->setNew(false);
@ -315,7 +368,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 4; // 4 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS.
return $startcol + 5; // 5 = ImportedPodcastPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating ImportedPodcast object", $e);
@ -562,6 +615,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) {
$modifiedColumns[':p' . $index++] = '"auto_ingest_timestamp"';
}
if ($this->isColumnModified(ImportedPodcastPeer::ALBUM_OVERRIDE)) {
$modifiedColumns[':p' . $index++] = '"album_override"';
}
if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) {
$modifiedColumns[':p' . $index++] = '"podcast_id"';
}
@ -585,6 +641,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
case '"auto_ingest_timestamp"':
$stmt->bindValue($identifier, $this->auto_ingest_timestamp, PDO::PARAM_STR);
break;
case '"album_override"':
$stmt->bindValue($identifier, $this->album_override, PDO::PARAM_BOOL);
break;
case '"podcast_id"':
$stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT);
break;
@ -737,6 +796,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
return $this->getDbAutoIngestTimestamp();
break;
case 3:
return $this->getDbAlbumOverride();
break;
case 4:
return $this->getDbPodcastId();
break;
default:
@ -771,7 +833,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbAutoIngest(),
$keys[2] => $this->getDbAutoIngestTimestamp(),
$keys[3] => $this->getDbPodcastId(),
$keys[3] => $this->getDbAlbumOverride(),
$keys[4] => $this->getDbPodcastId(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@ -826,6 +889,9 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$this->setDbAutoIngestTimestamp($value);
break;
case 3:
$this->setDbAlbumOverride($value);
break;
case 4:
$this->setDbPodcastId($value);
break;
} // switch()
@ -855,7 +921,8 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbAutoIngest($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbAutoIngestTimestamp($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbPodcastId($arr[$keys[3]]);
if (array_key_exists($keys[3], $arr)) $this->setDbAlbumOverride($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbPodcastId($arr[$keys[4]]);
}
/**
@ -870,6 +937,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
if ($this->isColumnModified(ImportedPodcastPeer::ID)) $criteria->add(ImportedPodcastPeer::ID, $this->id);
if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST, $this->auto_ingest);
if ($this->isColumnModified(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP)) $criteria->add(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $this->auto_ingest_timestamp);
if ($this->isColumnModified(ImportedPodcastPeer::ALBUM_OVERRIDE)) $criteria->add(ImportedPodcastPeer::ALBUM_OVERRIDE, $this->album_override);
if ($this->isColumnModified(ImportedPodcastPeer::PODCAST_ID)) $criteria->add(ImportedPodcastPeer::PODCAST_ID, $this->podcast_id);
return $criteria;
@ -936,6 +1004,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
{
$copyObj->setDbAutoIngest($this->getDbAutoIngest());
$copyObj->setDbAutoIngestTimestamp($this->getDbAutoIngestTimestamp());
$copyObj->setDbAlbumOverride($this->getDbAlbumOverride());
$copyObj->setDbPodcastId($this->getDbPodcastId());
if ($deepCopy && !$this->startCopy) {
@ -1055,6 +1124,7 @@ abstract class BaseImportedPodcast extends BaseObject implements Persistent
$this->id = null;
$this->auto_ingest = null;
$this->auto_ingest_timestamp = null;
$this->album_override = null;
$this->podcast_id = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;

View File

@ -24,13 +24,13 @@ abstract class BaseImportedPodcastPeer
const TM_CLASS = 'ImportedPodcastTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 4;
const NUM_COLUMNS = 5;
/** 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 = 5;
/** the column name for the id field */
const ID = 'imported_podcast.id';
@ -41,6 +41,9 @@ abstract class BaseImportedPodcastPeer
/** the column name for the auto_ingest_timestamp field */
const AUTO_INGEST_TIMESTAMP = 'imported_podcast.auto_ingest_timestamp';
/** the column name for the album_override field */
const ALBUM_OVERRIDE = 'imported_podcast.album_override';
/** the column name for the podcast_id field */
const PODCAST_ID = 'imported_podcast.podcast_id';
@ -63,12 +66,12 @@ abstract class BaseImportedPodcastPeer
* e.g. ImportedPodcastPeer::$fieldNames[ImportedPodcastPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbAutoIngest', 'DbAutoIngestTimestamp', 'DbPodcastId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbAutoIngestTimestamp', 'dbPodcastId', ),
BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, ImportedPodcastPeer::PODCAST_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'AUTO_INGEST', 'AUTO_INGEST_TIMESTAMP', 'PODCAST_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'auto_ingest_timestamp', 'podcast_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbAutoIngest', 'DbAutoIngestTimestamp', 'DbAlbumOverride', 'DbPodcastId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbAutoIngest', 'dbAutoIngestTimestamp', 'dbAlbumOverride', 'dbPodcastId', ),
BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID, ImportedPodcastPeer::AUTO_INGEST, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, ImportedPodcastPeer::ALBUM_OVERRIDE, ImportedPodcastPeer::PODCAST_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'AUTO_INGEST', 'AUTO_INGEST_TIMESTAMP', 'ALBUM_OVERRIDE', 'PODCAST_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'auto_ingest', 'auto_ingest_timestamp', 'album_override', 'podcast_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@ -78,12 +81,12 @@ abstract class BaseImportedPodcastPeer
* e.g. ImportedPodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbAutoIngest' => 1, 'DbAutoIngestTimestamp' => 2, 'DbPodcastId' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbAutoIngest' => 1, 'dbAutoIngestTimestamp' => 2, 'dbPodcastId' => 3, ),
BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP => 2, ImportedPodcastPeer::PODCAST_ID => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'AUTO_INGEST' => 1, 'AUTO_INGEST_TIMESTAMP' => 2, 'PODCAST_ID' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'auto_ingest' => 1, 'auto_ingest_timestamp' => 2, 'podcast_id' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbAutoIngest' => 1, 'DbAutoIngestTimestamp' => 2, 'DbAlbumOverride' => 3, 'DbPodcastId' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbAutoIngest' => 1, 'dbAutoIngestTimestamp' => 2, 'dbAlbumOverride' => 3, 'dbPodcastId' => 4, ),
BasePeer::TYPE_COLNAME => array (ImportedPodcastPeer::ID => 0, ImportedPodcastPeer::AUTO_INGEST => 1, ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP => 2, ImportedPodcastPeer::ALBUM_OVERRIDE => 3, ImportedPodcastPeer::PODCAST_ID => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'AUTO_INGEST' => 1, 'AUTO_INGEST_TIMESTAMP' => 2, 'ALBUM_OVERRIDE' => 3, 'PODCAST_ID' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'auto_ingest' => 1, 'auto_ingest_timestamp' => 2, 'album_override' => 3, 'podcast_id' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@ -160,11 +163,13 @@ abstract class BaseImportedPodcastPeer
$criteria->addSelectColumn(ImportedPodcastPeer::ID);
$criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST);
$criteria->addSelectColumn(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP);
$criteria->addSelectColumn(ImportedPodcastPeer::ALBUM_OVERRIDE);
$criteria->addSelectColumn(ImportedPodcastPeer::PODCAST_ID);
} else {
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.auto_ingest');
$criteria->addSelectColumn($alias . '.auto_ingest_timestamp');
$criteria->addSelectColumn($alias . '.album_override');
$criteria->addSelectColumn($alias . '.podcast_id');
}
}

View File

@ -9,11 +9,13 @@
* @method ImportedPodcastQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method ImportedPodcastQuery orderByDbAutoIngest($order = Criteria::ASC) Order by the auto_ingest column
* @method ImportedPodcastQuery orderByDbAutoIngestTimestamp($order = Criteria::ASC) Order by the auto_ingest_timestamp column
* @method ImportedPodcastQuery orderByDbAlbumOverride($order = Criteria::ASC) Order by the album_override column
* @method ImportedPodcastQuery orderByDbPodcastId($order = Criteria::ASC) Order by the podcast_id column
*
* @method ImportedPodcastQuery groupByDbId() Group by the id column
* @method ImportedPodcastQuery groupByDbAutoIngest() Group by the auto_ingest column
* @method ImportedPodcastQuery groupByDbAutoIngestTimestamp() Group by the auto_ingest_timestamp column
* @method ImportedPodcastQuery groupByDbAlbumOverride() Group by the album_override column
* @method ImportedPodcastQuery groupByDbPodcastId() Group by the podcast_id column
*
* @method ImportedPodcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
@ -29,11 +31,13 @@
*
* @method ImportedPodcast findOneByDbAutoIngest(boolean $auto_ingest) Return the first ImportedPodcast filtered by the auto_ingest column
* @method ImportedPodcast findOneByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return the first ImportedPodcast filtered by the auto_ingest_timestamp column
* @method ImportedPodcast findOneByDbAlbumOverride(boolean $album_override) Return the first ImportedPodcast filtered by the album_override column
* @method ImportedPodcast findOneByDbPodcastId(int $podcast_id) Return the first ImportedPodcast filtered by the podcast_id column
*
* @method array findByDbId(int $id) Return ImportedPodcast objects filtered by the id column
* @method array findByDbAutoIngest(boolean $auto_ingest) Return ImportedPodcast objects filtered by the auto_ingest column
* @method array findByDbAutoIngestTimestamp(string $auto_ingest_timestamp) Return ImportedPodcast objects filtered by the auto_ingest_timestamp column
* @method array findByDbAlbumOverride(boolean $album_override) Return ImportedPodcast objects filtered by the album_override column
* @method array findByDbPodcastId(int $podcast_id) Return ImportedPodcast objects filtered by the podcast_id column
*
* @package propel.generator.airtime.om
@ -142,7 +146,7 @@ abstract class BaseImportedPodcastQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "auto_ingest", "auto_ingest_timestamp", "podcast_id" FROM "imported_podcast" WHERE "id" = :p0';
$sql = 'SELECT "id", "auto_ingest", "auto_ingest_timestamp", "album_override", "podcast_id" FROM "imported_podcast" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@ -343,6 +347,33 @@ abstract class BaseImportedPodcastQuery extends ModelCriteria
return $this->addUsingAlias(ImportedPodcastPeer::AUTO_INGEST_TIMESTAMP, $dbAutoIngestTimestamp, $comparison);
}
/**
* Filter the query on the album_override column
*
* Example usage:
* <code>
* $query->filterByDbAlbumOverride(true); // WHERE album_override = true
* $query->filterByDbAlbumOverride('yes'); // WHERE album_override = true
* </code>
*
* @param boolean|string $dbAlbumOverride 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 filterByDbAlbumOverride($dbAlbumOverride = null, $comparison = null)
{
if (is_string($dbAlbumOverride)) {
$dbAlbumOverride = in_array(strtolower($dbAlbumOverride), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ImportedPodcastPeer::ALBUM_OVERRIDE, $dbAlbumOverride, $comparison);
}
/**
* Filter the query on the podcast_id column
*

View File

@ -605,6 +605,7 @@
<column name="id" phpName="DbId" required="true" primaryKey="true" autoIncrement="true" type="INTEGER"/>
<column name="auto_ingest" phpName="DbAutoIngest" type="BOOLEAN" required="true" defaultValue="false"/>
<column name="auto_ingest_timestamp" phpName="DbAutoIngestTimestamp" type="TIMESTAMP" required="false" />
<column name="album_override" phpName="DbAlbumOverride" type="BOOLEAN" required="true" defaultValue="false"/>
<column name="podcast_id" phpName="DbPodcastId" required="true" type="INTEGER"/>
<foreign-key foreignTable="podcast" name="podcast_id_fkey" onDelete="CASCADE">
<reference local="podcast_id" foreign="id" />

View File

@ -760,6 +760,7 @@ CREATE TABLE "imported_podcast"
"id" serial NOT NULL,
"auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL,
"auto_ingest_timestamp" TIMESTAMP,
"album_override" BOOLEAN DEFAULT 'f' NOT NULL,
"podcast_id" INTEGER NOT NULL,
PRIMARY KEY ("id")
);