From db976881f0f2d9ff1e51ad1ea12faf9463a1bb05 Mon Sep 17 00:00:00 2001 From: jo Date: Wed, 8 Jun 2022 16:31:01 +0200 Subject: [PATCH] fix: use constrained foreign key for files track_type --- .../migrations/0035_3_0_0_alpha_13_9.py | 55 +++ .../legacy/migrations/__init__.py | 2 +- .../legacy/migrations/sql/schema.sql | 6 +- api/libretime_api/storage/models/file.py | 7 +- api/schema.yml | 16 +- docs/releases/unreleased.md | 28 ++ legacy/application/configs/constants.php | 2 +- .../plugins/PageLayoutInitPlugin.php | 2 +- legacy/application/forms/EditAudioMD.php | 12 +- .../application/forms/SmartBlockCriteria.php | 8 +- legacy/application/models/Block.php | 7 +- legacy/application/models/Library.php | 2 +- legacy/application/models/StoredFile.php | 4 +- legacy/application/models/airtime/CcFiles.php | 6 +- .../models/airtime/map/CcFilesTableMap.php | 3 +- .../airtime/map/CcTracktypesTableMap.php | 1 + .../models/airtime/om/BaseCcFiles.php | 141 +++++-- .../models/airtime/om/BaseCcFilesPeer.php | 374 +++++++++++++++++- .../models/airtime/om/BaseCcFilesQuery.php | 129 +++++- .../models/airtime/om/BaseCcSubjs.php | 50 +++ .../models/airtime/om/BaseCcTracktypes.php | 366 ++++++++++++++++- .../airtime/om/BaseCcTracktypesQuery.php | 78 ++++ .../views/scripts/plupload/index.phtml | 8 +- legacy/build/schema.xml | 5 +- legacy/public/js/airtime/library/library.js | 17 +- .../js/airtime/playlist/smart_blockbuilder.js | 17 +- 26 files changed, 1233 insertions(+), 113 deletions(-) create mode 100644 api/libretime_api/legacy/migrations/0035_3_0_0_alpha_13_9.py diff --git a/api/libretime_api/legacy/migrations/0035_3_0_0_alpha_13_9.py b/api/libretime_api/legacy/migrations/0035_3_0_0_alpha_13_9.py new file mode 100644 index 000000000..3d6c2bbad --- /dev/null +++ b/api/libretime_api/legacy/migrations/0035_3_0_0_alpha_13_9.py @@ -0,0 +1,55 @@ +# pylint: disable=invalid-name + +from django.db import migrations + +from ._migrations import legacy_migration_factory + +UP = """ +ALTER TABLE "cc_files" ADD COLUMN "track_type_id" INTEGER; +ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_track_type_fkey" + FOREIGN KEY ("track_type_id") + REFERENCES "cc_track_types" ("id"); + +UPDATE "cc_files" previous SET "track_type_id" = ( + SELECT "id" FROM "cc_track_types" + WHERE "code" = previous."track_type" +) +WHERE "track_type" IS NOT NULL; + +UPDATE "cc_pref" previous SET "valstr" = ( + SELECT "id" FROM "cc_track_types" + WHERE "code" = previous."valstr" +) +WHERE "keystr" = 'tracktype_default' +AND "valstr" <> ''; + +ALTER TABLE "cc_files" DROP COLUMN IF EXISTS "track_type"; +""" + +DOWN = """ +ALTER TABLE "cc_files" DROP CONSTRAINT "cc_files_track_type_fkey"; +ALTER TABLE "cc_files" DROP COLUMN IF EXISTS "track_type_id"; + +ALTER TABLE "cc_files" ADD COLUMN "track_type" VARCHAR(16); + +UPDATE "cc_pref" previous SET "valstr" = ( + SELECT "code" FROM "cc_track_types" + WHERE "id" = previous."valstr"::int +) +WHERE "keystr" = 'tracktype_default' +AND "valstr" <> ''; +""" + + +class Migration(migrations.Migration): + dependencies = [ + ("legacy", "0034_3_0_0_alpha_13_8"), + ] + operations = [ + migrations.RunPython( + code=legacy_migration_factory( + target="3.0.0-alpha.13.9", + sql=UP, + ) + ) + ] diff --git a/api/libretime_api/legacy/migrations/__init__.py b/api/libretime_api/legacy/migrations/__init__.py index 443bd1911..b34ac7783 100644 --- a/api/libretime_api/legacy/migrations/__init__.py +++ b/api/libretime_api/legacy/migrations/__init__.py @@ -1 +1 @@ -LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.8" +LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.9" diff --git a/api/libretime_api/legacy/migrations/sql/schema.sql b/api/libretime_api/legacy/migrations/sql/schema.sql index 659140348..7fbc9eb80 100644 --- a/api/libretime_api/legacy/migrations/sql/schema.sql +++ b/api/libretime_api/legacy/migrations/sql/schema.sql @@ -74,7 +74,7 @@ CREATE TABLE "cc_files" "filesize" INTEGER DEFAULT 0 NOT NULL, "description" VARCHAR(512), "artwork" VARCHAR(4096), - "track_type" VARCHAR(16), + "track_type_id" INTEGER, PRIMARY KEY ("id") ); @@ -720,6 +720,10 @@ ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id"); +ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_track_type_fkey" + FOREIGN KEY ("track_type_id") + REFERENCES "cc_track_types" ("id"); + ALTER TABLE "cc_show" ADD CONSTRAINT "cc_playlist_autoplaylist_fkey" FOREIGN KEY ("autoplaylist_id") REFERENCES "cc_playlist" ("id") diff --git a/api/libretime_api/storage/models/file.py b/api/libretime_api/storage/models/file.py index 4d5d39d2a..a2e523aac 100644 --- a/api/libretime_api/storage/models/file.py +++ b/api/libretime_api/storage/models/file.py @@ -2,11 +2,12 @@ from django.db import models class File(models.Model): - library = models.CharField( - max_length=16, + library = models.ForeignKey( + "storage.Library", + models.DO_NOTHING, blank=True, null=True, - db_column="track_type", + db_column="track_type_id", ) owner = models.ForeignKey( diff --git a/api/schema.yml b/api/schema.yml index f90a27eef..fac845b00 100644 --- a/api/schema.yml +++ b/api/schema.yml @@ -5667,10 +5667,6 @@ components: id: type: integer readOnly: true - library: - type: string - nullable: true - maxLength: 16 import_status: allOf: - $ref: "#/components/schemas/ImportStatusEnum" @@ -5910,6 +5906,10 @@ components: type: string nullable: true maxLength: 512 + library: + type: string + format: uri + nullable: true owner: type: string format: uri @@ -6091,10 +6091,6 @@ components: id: type: integer readOnly: true - library: - type: string - nullable: true - maxLength: 16 import_status: allOf: - $ref: "#/components/schemas/ImportStatusEnum" @@ -6334,6 +6330,10 @@ components: type: string nullable: true maxLength: 512 + library: + type: string + format: uri + nullable: true owner: type: string format: uri diff --git a/docs/releases/unreleased.md b/docs/releases/unreleased.md index f5a9206b3..1eadd34b3 100644 --- a/docs/releases/unreleased.md +++ b/docs/releases/unreleased.md @@ -22,6 +22,34 @@ The allowed CORS origins configuration moved from the database to the configurat ## :arrow_up: Upgrading +### Repair broken track types + +:::caution + +Please run this **before the upgrade procedure**! + +::: + +The database files track type field was previously not constrained and this might have lead to files referencing a now renamed or missing track type. To preserve as much data as possible during the database migration process, you need to check whether some files have broken or missing track type references and fix them accordingly. To list broken track type references, you can run the following command: + +```bash +sudo -u www-data libretime-api dbshell --command=" + SELECT f.id, f.track_type, f.track_title, f.artist_name, f.filepath + FROM cc_files f + WHERE NOT EXISTS ( + SELECT FROM cc_track_types tt + WHERE tt.code = f.track_type + );" +``` + +If the above command outputs the following, no file needs fixing. + +``` + id | track_type | track_title | artist_name | filepath +----+------------+-------------+-------------+---------- +(0 rows) +``` + ### New configuration file :::caution diff --git a/legacy/application/configs/constants.php b/legacy/application/configs/constants.php index 4f0225fe7..4d38992cc 100644 --- a/legacy/application/configs/constants.php +++ b/legacy/application/configs/constants.php @@ -100,7 +100,7 @@ define('MDATA_KEY_CUE_IN', 'cuein'); define('MDATA_KEY_CUE_OUT', 'cueout'); define('MDATA_KEY_ARTWORK', 'artwork'); define('MDATA_KEY_ARTWORK_DATA', 'artwork_data'); -define('MDATA_KEY_TRACK_TYPE', 'track_type'); +define('MDATA_KEY_TRACK_TYPE', 'track_type_id'); define('UI_MDATA_VALUE_FORMAT_FILE', 'File'); define('UI_MDATA_VALUE_FORMAT_STREAM', 'live stream'); diff --git a/legacy/application/controllers/plugins/PageLayoutInitPlugin.php b/legacy/application/controllers/plugins/PageLayoutInitPlugin.php index fa3ca36c9..9e06a2b1f 100644 --- a/legacy/application/controllers/plugins/PageLayoutInitPlugin.php +++ b/legacy/application/controllers/plugins/PageLayoutInitPlugin.php @@ -144,7 +144,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract }, $track_types), SORT_ASC, $track_types); foreach ($track_types as $key => $tt) { - $track_type_options[$tt['code']] = $tt['type_name']; + $track_type_options[$tt['id']] = ['name' => $tt['type_name'], 'code' => $tt['code']]; } $ttarr = json_encode($track_type_options, JSON_FORCE_OBJECT); $view->headScript()->appendScript('var TRACKTYPES = ' . $ttarr . ';'); diff --git a/legacy/application/forms/EditAudioMD.php b/legacy/application/forms/EditAudioMD.php index 0d4e8957c..3bb20071e 100644 --- a/legacy/application/forms/EditAudioMD.php +++ b/legacy/application/forms/EditAudioMD.php @@ -101,14 +101,14 @@ class Application_Form_EditAudioMD extends Zend_Form $track_type_options[''] = _('Select a Type'); foreach ($track_types as $key => $tt) { - $track_type_options[$tt['code']] = $tt['type_name']; + $track_type_options[$tt['id']] = $tt['type_name']; } - $track_type = new Zend_Form_Element_Select('track_type'); - $track_type->class = 'input_text'; - $track_type->setLabel(_('Track Type:')); - $track_type->setMultiOptions($track_type_options); - $this->addelement($track_type); + $track_type_id = new Zend_Form_Element_Select('track_type_id'); + $track_type_id->class = 'input_text'; + $track_type_id->setLabel(_('Track Type:')); + $track_type_id->setMultiOptions($track_type_options); + $this->addelement($track_type_id); // Description field $description = new Zend_Form_Element_Textarea('description'); diff --git a/legacy/application/forms/SmartBlockCriteria.php b/legacy/application/forms/SmartBlockCriteria.php index 289d98c05..6a043c5f8 100644 --- a/legacy/application/forms/SmartBlockCriteria.php +++ b/legacy/application/forms/SmartBlockCriteria.php @@ -46,7 +46,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm 'track_number' => 'n', 'info_url' => 's', 'year' => 'n', - 'track_type' => 'tt', + 'track_type_id' => 'tt', ]; private function getCriteriaOptions($option = null) @@ -72,7 +72,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm 'mtime' => _('Last Modified'), 'lptime' => _('Last Played'), 'length' => _('Length'), - 'track_type' => _('Track Type'), + 'track_type_id' => _('Track Type'), 'mime' => _('Mime'), 'mood' => _('Mood'), 'owner_id' => _('Owner'), @@ -210,7 +210,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $tracktypes = Application_Model_Tracktype::getTracktypes(); $names[] = _('Select Track Type'); foreach ($tracktypes as $arr => $a) { - $names[$a['code']] = $tracktypes[$arr]['type_name']; + $names[$a['id']] = $tracktypes[$arr]['type_name']; } } @@ -793,7 +793,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm 'track_title' => 'DbTrackTitle', 'track_number' => 'DbTrackNumber', 'year' => 'DbYear', - 'track_type' => 'DbTrackType', + 'track_type_id' => 'DbTrackTypeId', ]; // things we need to check diff --git a/legacy/application/models/Block.php b/legacy/application/models/Block.php index c0782ef96..932009470 100644 --- a/legacy/application/models/Block.php +++ b/legacy/application/models/Block.php @@ -85,7 +85,7 @@ class Application_Model_Block implements Application_Model_LibraryEditable 'track_title' => 'DbTrackTitle', 'track_number' => 'DbTrackNumber', 'year' => 'DbYear', - 'track_type' => 'DbTrackType', + 'track_type_id' => 'DbTrackTypeId', ]; public function __construct($id = null, $con = null) @@ -1162,6 +1162,7 @@ SQL; public function saveSmartBlockCriteria($p_criteria) { $data = $this->organizeSmartPlaylistCriteria($p_criteria); + // saving dynamic/static flag $blockType = $data['etc']['sp_type'] == 0 ? 'dynamic' : 'static'; $this->saveType($blockType); @@ -1448,7 +1449,7 @@ SQL; 'mtime' => _('Last Modified'), 'lptime' => _('Last Played'), 'length' => _('Length'), - 'track_type' => _('Track Type'), + 'track_type_id' => _('Track Type'), 'mime' => _('Mime'), 'mood' => _('Mood'), 'owner_id' => _('Owner'), @@ -1546,7 +1547,7 @@ SQL; 'mtime' => _('Last Modified'), 'lptime' => _('Last Played'), 'length' => _('Length'), - 'track_type' => _('Track Type'), + 'track_type_id' => _('Track Type'), 'mime' => _('Mime'), 'mood' => _('Mood'), 'owner_id' => _('Owner'), diff --git a/legacy/application/models/Library.php b/legacy/application/models/Library.php index 882e09d7a..d4de485b8 100644 --- a/legacy/application/models/Library.php +++ b/legacy/application/models/Library.php @@ -62,7 +62,7 @@ class Application_Model_Library }, $track_types), SORT_ASC, $track_types); foreach ($track_types as $key => $tt) { - $track_type_options[$tt['code']] = $tt['type_name']; + $track_type_options[$tt['id']] = $tt['type_name']; } return $track_type_options; diff --git a/legacy/application/models/StoredFile.php b/legacy/application/models/StoredFile.php index be31817a2..92646d9eb 100644 --- a/legacy/application/models/StoredFile.php +++ b/legacy/application/models/StoredFile.php @@ -54,7 +54,7 @@ class Application_Model_StoredFile 'cueout' => 'DbCueOut', 'description' => 'DbDescription', 'artwork' => 'DbArtwork', - 'track_type' => 'DbTrackType', + 'track_type_id' => 'DbTrackTypeId', ]; public function __construct($file, $con) @@ -678,7 +678,7 @@ SQL; 'bit_rate', 'sample_rate', 'isrc_number', 'encoded_by', 'label', 'copyright', 'mime', 'language', 'filepath', 'owner_id', 'conductor', 'replay_gain', 'lptime', 'is_playlist', 'is_scheduled', - 'cuein', 'cueout', 'description', 'artwork', 'track_type', + 'cuein', 'cueout', 'description', 'artwork', 'track_type_id', ]; } diff --git a/legacy/application/models/airtime/CcFiles.php b/legacy/application/models/airtime/CcFiles.php index 6c80fc5d2..dac12fb23 100644 --- a/legacy/application/models/airtime/CcFiles.php +++ b/legacy/application/models/airtime/CcFiles.php @@ -153,7 +153,7 @@ class CcFiles extends BaseCcFiles $importedStorageDir = Config::getStoragePath() . 'imported/' . self::getOwnerId() . '/'; $importedDbPath = 'imported/' . self::getOwnerId() . '/'; $artwork = FileDataHelper::saveArtworkData($filePath, $originalFilename, $importedStorageDir, $importedDbPath); - $trackType = FileDataHelper::saveTrackType(); + $trackTypeId = FileDataHelper::saveTrackType(); $file->fromArray($fileArray); $file->setDbOwnerId(self::getOwnerId()); @@ -161,7 +161,9 @@ class CcFiles extends BaseCcFiles $file->setDbTrackTitle($originalFilename); $file->setDbMd5($md5); $file->setDbArtwork($artwork); - $file->setDbTrackType($trackType); + if ($trackTypeId) { + $file->setDbTrackTypeId($trackTypeId); + } $file->setDbUtime($now); $file->setDbHidden(true); $file->save(); diff --git a/legacy/application/models/airtime/map/CcFilesTableMap.php b/legacy/application/models/airtime/map/CcFilesTableMap.php index 8fa8cec4b..37b837dce 100644 --- a/legacy/application/models/airtime/map/CcFilesTableMap.php +++ b/legacy/application/models/airtime/map/CcFilesTableMap.php @@ -106,7 +106,7 @@ class CcFilesTableMap extends TableMap $this->addColumn('filesize', 'DbFilesize', 'INTEGER', true, null, 0); $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null); $this->addColumn('artwork', 'DbArtwork', 'VARCHAR', false, 4096, null); - $this->addColumn('track_type', 'DbTrackType', 'VARCHAR', false, 16, null); + $this->addForeignKey('track_type_id', 'DbTrackTypeId', 'INTEGER', 'cc_track_types', 'id', false, null, null); // validators } // initialize() @@ -117,6 +117,7 @@ class CcFilesTableMap extends TableMap { $this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null); $this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); + $this->addRelation('CcTracktypes', 'CcTracktypes', RelationMap::MANY_TO_ONE, array('track_type_id' => 'id', ), null, null); $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcShowInstancess'); $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlaylistcontentss'); $this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcBlockcontentss'); diff --git a/legacy/application/models/airtime/map/CcTracktypesTableMap.php b/legacy/application/models/airtime/map/CcTracktypesTableMap.php index b1a273762..851020d1a 100644 --- a/legacy/application/models/airtime/map/CcTracktypesTableMap.php +++ b/legacy/application/models/airtime/map/CcTracktypesTableMap.php @@ -52,6 +52,7 @@ class CcTracktypesTableMap extends TableMap */ public function buildRelations() { + $this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'track_type_id', ), null, null, 'CcFiless'); } // buildRelations() } // CcTracktypesTableMap diff --git a/legacy/application/models/airtime/om/BaseCcFiles.php b/legacy/application/models/airtime/om/BaseCcFiles.php index bc7d045d0..3a003a965 100644 --- a/legacy/application/models/airtime/om/BaseCcFiles.php +++ b/legacy/application/models/airtime/om/BaseCcFiles.php @@ -447,10 +447,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent protected $artwork; /** - * The value for the track_type field. - * @var string + * The value for the track_type_id field. + * @var int */ - protected $track_type; + protected $track_type_id; /** * @var CcSubjs @@ -462,6 +462,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent */ protected $aCcSubjsRelatedByDbEditedby; + /** + * @var CcTracktypes + */ + protected $aCcTracktypes; + /** * @var PropelObjectCollection|CcShowInstances[] Collection to store aggregation of CcShowInstances objects. */ @@ -1411,14 +1416,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } /** - * Get the [track_type] column value. + * Get the [track_type_id] column value. * - * @return string + * @return int */ - public function getDbTrackType() + public function getDbTrackTypeId() { - return $this->track_type; + return $this->track_type_id; } /** @@ -2883,25 +2888,29 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } // setDbArtwork() /** - * Set the value of [track_type] column. + * Set the value of [track_type_id] column. * - * @param string $v new value + * @param int $v new value * @return CcFiles The current object (for fluent API support) */ - public function setDbTrackType($v) + public function setDbTrackTypeId($v) { - if ($v !== null) { - $v = (string) $v; + if ($v !== null && is_numeric($v)) { + $v = (int) $v; } - if ($this->track_type !== $v) { - $this->track_type = $v; - $this->modifiedColumns[] = CcFilesPeer::TRACK_TYPE; + if ($this->track_type_id !== $v) { + $this->track_type_id = $v; + $this->modifiedColumns[] = CcFilesPeer::TRACK_TYPE_ID; + } + + if ($this->aCcTracktypes !== null && $this->aCcTracktypes->getDbId() !== $v) { + $this->aCcTracktypes = null; } return $this; - } // setDbTrackType() + } // setDbTrackTypeId() /** * Indicates whether the columns in this object are only set to default values. @@ -3062,7 +3071,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->filesize = ($row[$startcol + 64] !== null) ? (int) $row[$startcol + 64] : null; $this->description = ($row[$startcol + 65] !== null) ? (string) $row[$startcol + 65] : null; $this->artwork = ($row[$startcol + 66] !== null) ? (string) $row[$startcol + 66] : null; - $this->track_type = ($row[$startcol + 67] !== null) ? (string) $row[$startcol + 67] : null; + $this->track_type_id = ($row[$startcol + 67] !== null) ? (int) $row[$startcol + 67] : null; $this->resetModified(); $this->setNew(false); @@ -3101,6 +3110,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->aFkOwner !== null && $this->owner_id !== $this->aFkOwner->getDbId()) { $this->aFkOwner = null; } + if ($this->aCcTracktypes !== null && $this->track_type_id !== $this->aCcTracktypes->getDbId()) { + $this->aCcTracktypes = null; + } } // ensureConsistency /** @@ -3142,6 +3154,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->aFkOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; + $this->aCcTracktypes = null; $this->collCcShowInstancess = null; $this->collCcPlaylistcontentss = null; @@ -3288,6 +3301,13 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->setCcSubjsRelatedByDbEditedby($this->aCcSubjsRelatedByDbEditedby); } + if ($this->aCcTracktypes !== null) { + if ($this->aCcTracktypes->isModified() || $this->aCcTracktypes->isNew()) { + $affectedRows += $this->aCcTracktypes->save($con); + } + $this->setCcTracktypes($this->aCcTracktypes); + } + if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { @@ -3655,8 +3675,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->isColumnModified(CcFilesPeer::ARTWORK)) { $modifiedColumns[':p' . $index++] = '"artwork"'; } - if ($this->isColumnModified(CcFilesPeer::TRACK_TYPE)) { - $modifiedColumns[':p' . $index++] = '"track_type"'; + if ($this->isColumnModified(CcFilesPeer::TRACK_TYPE_ID)) { + $modifiedColumns[':p' . $index++] = '"track_type_id"'; } $sql = sprintf( @@ -3870,8 +3890,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case '"artwork"': $stmt->bindValue($identifier, $this->artwork, PDO::PARAM_STR); break; - case '"track_type"': - $stmt->bindValue($identifier, $this->track_type, PDO::PARAM_STR); + case '"track_type_id"': + $stmt->bindValue($identifier, $this->track_type_id, PDO::PARAM_INT); break; } } @@ -3977,6 +3997,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } } + if ($this->aCcTracktypes !== null) { + if (!$this->aCcTracktypes->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcTracktypes->getValidationFailures()); + } + } + if (($retval = CcFilesPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); @@ -4276,7 +4302,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this->getDbArtwork(); break; case 67: - return $this->getDbTrackType(); + return $this->getDbTrackTypeId(); break; default: return null; @@ -4374,7 +4400,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $keys[64] => $this->getDbFilesize(), $keys[65] => $this->getDbDescription(), $keys[66] => $this->getDbArtwork(), - $keys[67] => $this->getDbTrackType(), + $keys[67] => $this->getDbTrackTypeId(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -4388,6 +4414,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if (null !== $this->aCcSubjsRelatedByDbEditedby) { $result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } + if (null !== $this->aCcTracktypes) { + $result['CcTracktypes'] = $this->aCcTracktypes->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } if (null !== $this->collCcShowInstancess) { $result['CcShowInstancess'] = $this->collCcShowInstancess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -4645,7 +4674,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->setDbArtwork($value); break; case 67: - $this->setDbTrackType($value); + $this->setDbTrackTypeId($value); break; } // switch() } @@ -4738,7 +4767,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if (array_key_exists($keys[64], $arr)) $this->setDbFilesize($arr[$keys[64]]); if (array_key_exists($keys[65], $arr)) $this->setDbDescription($arr[$keys[65]]); if (array_key_exists($keys[66], $arr)) $this->setDbArtwork($arr[$keys[66]]); - if (array_key_exists($keys[67], $arr)) $this->setDbTrackType($arr[$keys[67]]); + if (array_key_exists($keys[67], $arr)) $this->setDbTrackTypeId($arr[$keys[67]]); } /** @@ -4817,7 +4846,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->isColumnModified(CcFilesPeer::FILESIZE)) $criteria->add(CcFilesPeer::FILESIZE, $this->filesize); if ($this->isColumnModified(CcFilesPeer::DESCRIPTION)) $criteria->add(CcFilesPeer::DESCRIPTION, $this->description); if ($this->isColumnModified(CcFilesPeer::ARTWORK)) $criteria->add(CcFilesPeer::ARTWORK, $this->artwork); - if ($this->isColumnModified(CcFilesPeer::TRACK_TYPE)) $criteria->add(CcFilesPeer::TRACK_TYPE, $this->track_type); + if ($this->isColumnModified(CcFilesPeer::TRACK_TYPE_ID)) $criteria->add(CcFilesPeer::TRACK_TYPE_ID, $this->track_type_id); return $criteria; } @@ -4947,7 +4976,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $copyObj->setDbFilesize($this->getDbFilesize()); $copyObj->setDbDescription($this->getDbDescription()); $copyObj->setDbArtwork($this->getDbArtwork()); - $copyObj->setDbTrackType($this->getDbTrackType()); + $copyObj->setDbTrackTypeId($this->getDbTrackTypeId()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -5152,6 +5181,58 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this->aCcSubjsRelatedByDbEditedby; } + /** + * Declares an association between this object and a CcTracktypes object. + * + * @param CcTracktypes $v + * @return CcFiles The current object (for fluent API support) + * @throws PropelException + */ + public function setCcTracktypes(CcTracktypes $v = null) + { + if ($v === null) { + $this->setDbTrackTypeId(NULL); + } else { + $this->setDbTrackTypeId($v->getDbId()); + } + + $this->aCcTracktypes = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcTracktypes object, it will not be re-added. + if ($v !== null) { + $v->addCcFiles($this); + } + + + return $this; + } + + + /** + * Get the associated CcTracktypes object + * + * @param PropelPDO $con Optional Connection object. + * @param $doQuery Executes a query to get the object if required + * @return CcTracktypes The associated CcTracktypes object. + * @throws PropelException + */ + public function getCcTracktypes(PropelPDO $con = null, $doQuery = true) + { + if ($this->aCcTracktypes === null && ($this->track_type_id !== null) && $doQuery) { + $this->aCcTracktypes = CcTracktypesQuery::create()->findPk($this->track_type_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCcTracktypes->addCcFiless($this); + */ + } + + return $this->aCcTracktypes; + } + /** * Initializes a collection based on the name of a relation. @@ -7058,7 +7139,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->filesize = null; $this->description = null; $this->artwork = null; - $this->track_type = null; + $this->track_type_id = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; @@ -7123,6 +7204,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->aCcSubjsRelatedByDbEditedby instanceof Persistent) { $this->aCcSubjsRelatedByDbEditedby->clearAllReferences($deep); } + if ($this->aCcTracktypes instanceof Persistent) { + $this->aCcTracktypes->clearAllReferences($deep); + } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) @@ -7157,6 +7241,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collPodcastEpisodess = null; $this->aFkOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; + $this->aCcTracktypes = null; } /** diff --git a/legacy/application/models/airtime/om/BaseCcFilesPeer.php b/legacy/application/models/airtime/om/BaseCcFilesPeer.php index 0d42f6185..7e7f7a2ce 100644 --- a/legacy/application/models/airtime/om/BaseCcFilesPeer.php +++ b/legacy/application/models/airtime/om/BaseCcFilesPeer.php @@ -233,8 +233,8 @@ abstract class BaseCcFilesPeer /** the column name for the artwork field */ const ARTWORK = 'cc_files.artwork'; - /** the column name for the track_type field */ - const TRACK_TYPE = 'cc_files.track_type'; + /** the column name for the track_type_id field */ + const TRACK_TYPE_ID = 'cc_files.track_type_id'; /** The default string format for model objects of the related table **/ const DEFAULT_STRING_FORMAT = 'YAML'; @@ -255,11 +255,11 @@ abstract class BaseCcFilesPeer * e.g. CcFilesPeer::$fieldNames[CcFilesPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbFileExists', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbFilesize', 'DbDescription', 'DbArtwork', 'DbTrackType', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbFileExists', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbFilesize', 'dbDescription', 'dbArtwork', 'dbTrackType', ), - BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID, CcFilesPeer::NAME, CcFilesPeer::MIME, CcFilesPeer::FTYPE, CcFilesPeer::FILEPATH, CcFilesPeer::IMPORT_STATUS, CcFilesPeer::CURRENTLYACCESSING, CcFilesPeer::EDITEDBY, CcFilesPeer::MTIME, CcFilesPeer::UTIME, CcFilesPeer::LPTIME, CcFilesPeer::MD5, CcFilesPeer::TRACK_TITLE, CcFilesPeer::ARTIST_NAME, CcFilesPeer::BIT_RATE, CcFilesPeer::SAMPLE_RATE, CcFilesPeer::FORMAT, CcFilesPeer::LENGTH, CcFilesPeer::ALBUM_TITLE, CcFilesPeer::GENRE, CcFilesPeer::COMMENTS, CcFilesPeer::YEAR, CcFilesPeer::TRACK_NUMBER, CcFilesPeer::CHANNELS, CcFilesPeer::URL, CcFilesPeer::BPM, CcFilesPeer::RATING, CcFilesPeer::ENCODED_BY, CcFilesPeer::DISC_NUMBER, CcFilesPeer::MOOD, CcFilesPeer::LABEL, CcFilesPeer::COMPOSER, CcFilesPeer::ENCODER, CcFilesPeer::CHECKSUM, CcFilesPeer::LYRICS, CcFilesPeer::ORCHESTRA, CcFilesPeer::CONDUCTOR, CcFilesPeer::LYRICIST, CcFilesPeer::ORIGINAL_LYRICIST, CcFilesPeer::RADIO_STATION_NAME, CcFilesPeer::INFO_URL, CcFilesPeer::ARTIST_URL, CcFilesPeer::AUDIO_SOURCE_URL, CcFilesPeer::RADIO_STATION_URL, CcFilesPeer::BUY_THIS_URL, CcFilesPeer::ISRC_NUMBER, CcFilesPeer::CATALOG_NUMBER, CcFilesPeer::ORIGINAL_ARTIST, CcFilesPeer::COPYRIGHT, CcFilesPeer::REPORT_DATETIME, CcFilesPeer::REPORT_LOCATION, CcFilesPeer::REPORT_ORGANIZATION, CcFilesPeer::SUBJECT, CcFilesPeer::CONTRIBUTOR, CcFilesPeer::LANGUAGE, CcFilesPeer::FILE_EXISTS, CcFilesPeer::REPLAY_GAIN, CcFilesPeer::OWNER_ID, CcFilesPeer::CUEIN, CcFilesPeer::CUEOUT, CcFilesPeer::SILAN_CHECK, CcFilesPeer::HIDDEN, CcFilesPeer::IS_SCHEDULED, CcFilesPeer::IS_PLAYLIST, CcFilesPeer::FILESIZE, CcFilesPeer::DESCRIPTION, CcFilesPeer::ARTWORK, CcFilesPeer::TRACK_TYPE, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'FILE_EXISTS', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'FILESIZE', 'DESCRIPTION', 'ARTWORK', 'TRACK_TYPE', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'file_exists', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'filesize', 'description', 'artwork', 'track_type', ), + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbFileExists', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbFilesize', 'DbDescription', 'DbArtwork', 'DbTrackTypeId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbFileExists', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbFilesize', 'dbDescription', 'dbArtwork', 'dbTrackTypeId', ), + BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID, CcFilesPeer::NAME, CcFilesPeer::MIME, CcFilesPeer::FTYPE, CcFilesPeer::FILEPATH, CcFilesPeer::IMPORT_STATUS, CcFilesPeer::CURRENTLYACCESSING, CcFilesPeer::EDITEDBY, CcFilesPeer::MTIME, CcFilesPeer::UTIME, CcFilesPeer::LPTIME, CcFilesPeer::MD5, CcFilesPeer::TRACK_TITLE, CcFilesPeer::ARTIST_NAME, CcFilesPeer::BIT_RATE, CcFilesPeer::SAMPLE_RATE, CcFilesPeer::FORMAT, CcFilesPeer::LENGTH, CcFilesPeer::ALBUM_TITLE, CcFilesPeer::GENRE, CcFilesPeer::COMMENTS, CcFilesPeer::YEAR, CcFilesPeer::TRACK_NUMBER, CcFilesPeer::CHANNELS, CcFilesPeer::URL, CcFilesPeer::BPM, CcFilesPeer::RATING, CcFilesPeer::ENCODED_BY, CcFilesPeer::DISC_NUMBER, CcFilesPeer::MOOD, CcFilesPeer::LABEL, CcFilesPeer::COMPOSER, CcFilesPeer::ENCODER, CcFilesPeer::CHECKSUM, CcFilesPeer::LYRICS, CcFilesPeer::ORCHESTRA, CcFilesPeer::CONDUCTOR, CcFilesPeer::LYRICIST, CcFilesPeer::ORIGINAL_LYRICIST, CcFilesPeer::RADIO_STATION_NAME, CcFilesPeer::INFO_URL, CcFilesPeer::ARTIST_URL, CcFilesPeer::AUDIO_SOURCE_URL, CcFilesPeer::RADIO_STATION_URL, CcFilesPeer::BUY_THIS_URL, CcFilesPeer::ISRC_NUMBER, CcFilesPeer::CATALOG_NUMBER, CcFilesPeer::ORIGINAL_ARTIST, CcFilesPeer::COPYRIGHT, CcFilesPeer::REPORT_DATETIME, CcFilesPeer::REPORT_LOCATION, CcFilesPeer::REPORT_ORGANIZATION, CcFilesPeer::SUBJECT, CcFilesPeer::CONTRIBUTOR, CcFilesPeer::LANGUAGE, CcFilesPeer::FILE_EXISTS, CcFilesPeer::REPLAY_GAIN, CcFilesPeer::OWNER_ID, CcFilesPeer::CUEIN, CcFilesPeer::CUEOUT, CcFilesPeer::SILAN_CHECK, CcFilesPeer::HIDDEN, CcFilesPeer::IS_SCHEDULED, CcFilesPeer::IS_PLAYLIST, CcFilesPeer::FILESIZE, CcFilesPeer::DESCRIPTION, CcFilesPeer::ARTWORK, CcFilesPeer::TRACK_TYPE_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'FILE_EXISTS', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'FILESIZE', 'DESCRIPTION', 'ARTWORK', 'TRACK_TYPE_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'file_exists', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'filesize', 'description', 'artwork', 'track_type_id', ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, ) ); @@ -270,11 +270,11 @@ abstract class BaseCcFilesPeer * e.g. CcFilesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbFilepath' => 4, 'DbImportStatus' => 5, 'DbCurrentlyaccessing' => 6, 'DbEditedby' => 7, 'DbMtime' => 8, 'DbUtime' => 9, 'DbLPtime' => 10, 'DbMd5' => 11, 'DbTrackTitle' => 12, 'DbArtistName' => 13, 'DbBitRate' => 14, 'DbSampleRate' => 15, 'DbFormat' => 16, 'DbLength' => 17, 'DbAlbumTitle' => 18, 'DbGenre' => 19, 'DbComments' => 20, 'DbYear' => 21, 'DbTrackNumber' => 22, 'DbChannels' => 23, 'DbUrl' => 24, 'DbBpm' => 25, 'DbRating' => 26, 'DbEncodedBy' => 27, 'DbDiscNumber' => 28, 'DbMood' => 29, 'DbLabel' => 30, 'DbComposer' => 31, 'DbEncoder' => 32, 'DbChecksum' => 33, 'DbLyrics' => 34, 'DbOrchestra' => 35, 'DbConductor' => 36, 'DbLyricist' => 37, 'DbOriginalLyricist' => 38, 'DbRadioStationName' => 39, 'DbInfoUrl' => 40, 'DbArtistUrl' => 41, 'DbAudioSourceUrl' => 42, 'DbRadioStationUrl' => 43, 'DbBuyThisUrl' => 44, 'DbIsrcNumber' => 45, 'DbCatalogNumber' => 46, 'DbOriginalArtist' => 47, 'DbCopyright' => 48, 'DbReportDatetime' => 49, 'DbReportLocation' => 50, 'DbReportOrganization' => 51, 'DbSubject' => 52, 'DbContributor' => 53, 'DbLanguage' => 54, 'DbFileExists' => 55, 'DbReplayGain' => 56, 'DbOwnerId' => 57, 'DbCuein' => 58, 'DbCueout' => 59, 'DbSilanCheck' => 60, 'DbHidden' => 61, 'DbIsScheduled' => 62, 'DbIsPlaylist' => 63, 'DbFilesize' => 64, 'DbDescription' => 65, 'DbArtwork' => 66, 'DbTrackType' => 67, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbFilepath' => 4, 'dbImportStatus' => 5, 'dbCurrentlyaccessing' => 6, 'dbEditedby' => 7, 'dbMtime' => 8, 'dbUtime' => 9, 'dbLPtime' => 10, 'dbMd5' => 11, 'dbTrackTitle' => 12, 'dbArtistName' => 13, 'dbBitRate' => 14, 'dbSampleRate' => 15, 'dbFormat' => 16, 'dbLength' => 17, 'dbAlbumTitle' => 18, 'dbGenre' => 19, 'dbComments' => 20, 'dbYear' => 21, 'dbTrackNumber' => 22, 'dbChannels' => 23, 'dbUrl' => 24, 'dbBpm' => 25, 'dbRating' => 26, 'dbEncodedBy' => 27, 'dbDiscNumber' => 28, 'dbMood' => 29, 'dbLabel' => 30, 'dbComposer' => 31, 'dbEncoder' => 32, 'dbChecksum' => 33, 'dbLyrics' => 34, 'dbOrchestra' => 35, 'dbConductor' => 36, 'dbLyricist' => 37, 'dbOriginalLyricist' => 38, 'dbRadioStationName' => 39, 'dbInfoUrl' => 40, 'dbArtistUrl' => 41, 'dbAudioSourceUrl' => 42, 'dbRadioStationUrl' => 43, 'dbBuyThisUrl' => 44, 'dbIsrcNumber' => 45, 'dbCatalogNumber' => 46, 'dbOriginalArtist' => 47, 'dbCopyright' => 48, 'dbReportDatetime' => 49, 'dbReportLocation' => 50, 'dbReportOrganization' => 51, 'dbSubject' => 52, 'dbContributor' => 53, 'dbLanguage' => 54, 'dbFileExists' => 55, 'dbReplayGain' => 56, 'dbOwnerId' => 57, 'dbCuein' => 58, 'dbCueout' => 59, 'dbSilanCheck' => 60, 'dbHidden' => 61, 'dbIsScheduled' => 62, 'dbIsPlaylist' => 63, 'dbFilesize' => 64, 'dbDescription' => 65, 'dbArtwork' => 66, 'dbTrackType' => 67, ), - BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID => 0, CcFilesPeer::NAME => 1, CcFilesPeer::MIME => 2, CcFilesPeer::FTYPE => 3, CcFilesPeer::FILEPATH => 4, CcFilesPeer::IMPORT_STATUS => 5, CcFilesPeer::CURRENTLYACCESSING => 6, CcFilesPeer::EDITEDBY => 7, CcFilesPeer::MTIME => 8, CcFilesPeer::UTIME => 9, CcFilesPeer::LPTIME => 10, CcFilesPeer::MD5 => 11, CcFilesPeer::TRACK_TITLE => 12, CcFilesPeer::ARTIST_NAME => 13, CcFilesPeer::BIT_RATE => 14, CcFilesPeer::SAMPLE_RATE => 15, CcFilesPeer::FORMAT => 16, CcFilesPeer::LENGTH => 17, CcFilesPeer::ALBUM_TITLE => 18, CcFilesPeer::GENRE => 19, CcFilesPeer::COMMENTS => 20, CcFilesPeer::YEAR => 21, CcFilesPeer::TRACK_NUMBER => 22, CcFilesPeer::CHANNELS => 23, CcFilesPeer::URL => 24, CcFilesPeer::BPM => 25, CcFilesPeer::RATING => 26, CcFilesPeer::ENCODED_BY => 27, CcFilesPeer::DISC_NUMBER => 28, CcFilesPeer::MOOD => 29, CcFilesPeer::LABEL => 30, CcFilesPeer::COMPOSER => 31, CcFilesPeer::ENCODER => 32, CcFilesPeer::CHECKSUM => 33, CcFilesPeer::LYRICS => 34, CcFilesPeer::ORCHESTRA => 35, CcFilesPeer::CONDUCTOR => 36, CcFilesPeer::LYRICIST => 37, CcFilesPeer::ORIGINAL_LYRICIST => 38, CcFilesPeer::RADIO_STATION_NAME => 39, CcFilesPeer::INFO_URL => 40, CcFilesPeer::ARTIST_URL => 41, CcFilesPeer::AUDIO_SOURCE_URL => 42, CcFilesPeer::RADIO_STATION_URL => 43, CcFilesPeer::BUY_THIS_URL => 44, CcFilesPeer::ISRC_NUMBER => 45, CcFilesPeer::CATALOG_NUMBER => 46, CcFilesPeer::ORIGINAL_ARTIST => 47, CcFilesPeer::COPYRIGHT => 48, CcFilesPeer::REPORT_DATETIME => 49, CcFilesPeer::REPORT_LOCATION => 50, CcFilesPeer::REPORT_ORGANIZATION => 51, CcFilesPeer::SUBJECT => 52, CcFilesPeer::CONTRIBUTOR => 53, CcFilesPeer::LANGUAGE => 54, CcFilesPeer::FILE_EXISTS => 55, CcFilesPeer::REPLAY_GAIN => 56, CcFilesPeer::OWNER_ID => 57, CcFilesPeer::CUEIN => 58, CcFilesPeer::CUEOUT => 59, CcFilesPeer::SILAN_CHECK => 60, CcFilesPeer::HIDDEN => 61, CcFilesPeer::IS_SCHEDULED => 62, CcFilesPeer::IS_PLAYLIST => 63, CcFilesPeer::FILESIZE => 64, CcFilesPeer::DESCRIPTION => 65, CcFilesPeer::ARTWORK => 66, CcFilesPeer::TRACK_TYPE => 67, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'FILEPATH' => 4, 'IMPORT_STATUS' => 5, 'CURRENTLYACCESSING' => 6, 'EDITEDBY' => 7, 'MTIME' => 8, 'UTIME' => 9, 'LPTIME' => 10, 'MD5' => 11, 'TRACK_TITLE' => 12, 'ARTIST_NAME' => 13, 'BIT_RATE' => 14, 'SAMPLE_RATE' => 15, 'FORMAT' => 16, 'LENGTH' => 17, 'ALBUM_TITLE' => 18, 'GENRE' => 19, 'COMMENTS' => 20, 'YEAR' => 21, 'TRACK_NUMBER' => 22, 'CHANNELS' => 23, 'URL' => 24, 'BPM' => 25, 'RATING' => 26, 'ENCODED_BY' => 27, 'DISC_NUMBER' => 28, 'MOOD' => 29, 'LABEL' => 30, 'COMPOSER' => 31, 'ENCODER' => 32, 'CHECKSUM' => 33, 'LYRICS' => 34, 'ORCHESTRA' => 35, 'CONDUCTOR' => 36, 'LYRICIST' => 37, 'ORIGINAL_LYRICIST' => 38, 'RADIO_STATION_NAME' => 39, 'INFO_URL' => 40, 'ARTIST_URL' => 41, 'AUDIO_SOURCE_URL' => 42, 'RADIO_STATION_URL' => 43, 'BUY_THIS_URL' => 44, 'ISRC_NUMBER' => 45, 'CATALOG_NUMBER' => 46, 'ORIGINAL_ARTIST' => 47, 'COPYRIGHT' => 48, 'REPORT_DATETIME' => 49, 'REPORT_LOCATION' => 50, 'REPORT_ORGANIZATION' => 51, 'SUBJECT' => 52, 'CONTRIBUTOR' => 53, 'LANGUAGE' => 54, 'FILE_EXISTS' => 55, 'REPLAY_GAIN' => 56, 'OWNER_ID' => 57, 'CUEIN' => 58, 'CUEOUT' => 59, 'SILAN_CHECK' => 60, 'HIDDEN' => 61, 'IS_SCHEDULED' => 62, 'IS_PLAYLIST' => 63, 'FILESIZE' => 64, 'DESCRIPTION' => 65, 'ARTWORK' => 66, 'TRACK_TYPE' => 67, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'filepath' => 4, 'import_status' => 5, 'currentlyaccessing' => 6, 'editedby' => 7, 'mtime' => 8, 'utime' => 9, 'lptime' => 10, 'md5' => 11, 'track_title' => 12, 'artist_name' => 13, 'bit_rate' => 14, 'sample_rate' => 15, 'format' => 16, 'length' => 17, 'album_title' => 18, 'genre' => 19, 'comments' => 20, 'year' => 21, 'track_number' => 22, 'channels' => 23, 'url' => 24, 'bpm' => 25, 'rating' => 26, 'encoded_by' => 27, 'disc_number' => 28, 'mood' => 29, 'label' => 30, 'composer' => 31, 'encoder' => 32, 'checksum' => 33, 'lyrics' => 34, 'orchestra' => 35, 'conductor' => 36, 'lyricist' => 37, 'original_lyricist' => 38, 'radio_station_name' => 39, 'info_url' => 40, 'artist_url' => 41, 'audio_source_url' => 42, 'radio_station_url' => 43, 'buy_this_url' => 44, 'isrc_number' => 45, 'catalog_number' => 46, 'original_artist' => 47, 'copyright' => 48, 'report_datetime' => 49, 'report_location' => 50, 'report_organization' => 51, 'subject' => 52, 'contributor' => 53, 'language' => 54, 'file_exists' => 55, 'replay_gain' => 56, 'owner_id' => 57, 'cuein' => 58, 'cueout' => 59, 'silan_check' => 60, 'hidden' => 61, 'is_scheduled' => 62, 'is_playlist' => 63, 'filesize' => 64, 'description' => 65, 'artwork' => 66, 'track_type' => 67, ), + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbFilepath' => 4, 'DbImportStatus' => 5, 'DbCurrentlyaccessing' => 6, 'DbEditedby' => 7, 'DbMtime' => 8, 'DbUtime' => 9, 'DbLPtime' => 10, 'DbMd5' => 11, 'DbTrackTitle' => 12, 'DbArtistName' => 13, 'DbBitRate' => 14, 'DbSampleRate' => 15, 'DbFormat' => 16, 'DbLength' => 17, 'DbAlbumTitle' => 18, 'DbGenre' => 19, 'DbComments' => 20, 'DbYear' => 21, 'DbTrackNumber' => 22, 'DbChannels' => 23, 'DbUrl' => 24, 'DbBpm' => 25, 'DbRating' => 26, 'DbEncodedBy' => 27, 'DbDiscNumber' => 28, 'DbMood' => 29, 'DbLabel' => 30, 'DbComposer' => 31, 'DbEncoder' => 32, 'DbChecksum' => 33, 'DbLyrics' => 34, 'DbOrchestra' => 35, 'DbConductor' => 36, 'DbLyricist' => 37, 'DbOriginalLyricist' => 38, 'DbRadioStationName' => 39, 'DbInfoUrl' => 40, 'DbArtistUrl' => 41, 'DbAudioSourceUrl' => 42, 'DbRadioStationUrl' => 43, 'DbBuyThisUrl' => 44, 'DbIsrcNumber' => 45, 'DbCatalogNumber' => 46, 'DbOriginalArtist' => 47, 'DbCopyright' => 48, 'DbReportDatetime' => 49, 'DbReportLocation' => 50, 'DbReportOrganization' => 51, 'DbSubject' => 52, 'DbContributor' => 53, 'DbLanguage' => 54, 'DbFileExists' => 55, 'DbReplayGain' => 56, 'DbOwnerId' => 57, 'DbCuein' => 58, 'DbCueout' => 59, 'DbSilanCheck' => 60, 'DbHidden' => 61, 'DbIsScheduled' => 62, 'DbIsPlaylist' => 63, 'DbFilesize' => 64, 'DbDescription' => 65, 'DbArtwork' => 66, 'DbTrackTypeId' => 67, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbFilepath' => 4, 'dbImportStatus' => 5, 'dbCurrentlyaccessing' => 6, 'dbEditedby' => 7, 'dbMtime' => 8, 'dbUtime' => 9, 'dbLPtime' => 10, 'dbMd5' => 11, 'dbTrackTitle' => 12, 'dbArtistName' => 13, 'dbBitRate' => 14, 'dbSampleRate' => 15, 'dbFormat' => 16, 'dbLength' => 17, 'dbAlbumTitle' => 18, 'dbGenre' => 19, 'dbComments' => 20, 'dbYear' => 21, 'dbTrackNumber' => 22, 'dbChannels' => 23, 'dbUrl' => 24, 'dbBpm' => 25, 'dbRating' => 26, 'dbEncodedBy' => 27, 'dbDiscNumber' => 28, 'dbMood' => 29, 'dbLabel' => 30, 'dbComposer' => 31, 'dbEncoder' => 32, 'dbChecksum' => 33, 'dbLyrics' => 34, 'dbOrchestra' => 35, 'dbConductor' => 36, 'dbLyricist' => 37, 'dbOriginalLyricist' => 38, 'dbRadioStationName' => 39, 'dbInfoUrl' => 40, 'dbArtistUrl' => 41, 'dbAudioSourceUrl' => 42, 'dbRadioStationUrl' => 43, 'dbBuyThisUrl' => 44, 'dbIsrcNumber' => 45, 'dbCatalogNumber' => 46, 'dbOriginalArtist' => 47, 'dbCopyright' => 48, 'dbReportDatetime' => 49, 'dbReportLocation' => 50, 'dbReportOrganization' => 51, 'dbSubject' => 52, 'dbContributor' => 53, 'dbLanguage' => 54, 'dbFileExists' => 55, 'dbReplayGain' => 56, 'dbOwnerId' => 57, 'dbCuein' => 58, 'dbCueout' => 59, 'dbSilanCheck' => 60, 'dbHidden' => 61, 'dbIsScheduled' => 62, 'dbIsPlaylist' => 63, 'dbFilesize' => 64, 'dbDescription' => 65, 'dbArtwork' => 66, 'dbTrackTypeId' => 67, ), + BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID => 0, CcFilesPeer::NAME => 1, CcFilesPeer::MIME => 2, CcFilesPeer::FTYPE => 3, CcFilesPeer::FILEPATH => 4, CcFilesPeer::IMPORT_STATUS => 5, CcFilesPeer::CURRENTLYACCESSING => 6, CcFilesPeer::EDITEDBY => 7, CcFilesPeer::MTIME => 8, CcFilesPeer::UTIME => 9, CcFilesPeer::LPTIME => 10, CcFilesPeer::MD5 => 11, CcFilesPeer::TRACK_TITLE => 12, CcFilesPeer::ARTIST_NAME => 13, CcFilesPeer::BIT_RATE => 14, CcFilesPeer::SAMPLE_RATE => 15, CcFilesPeer::FORMAT => 16, CcFilesPeer::LENGTH => 17, CcFilesPeer::ALBUM_TITLE => 18, CcFilesPeer::GENRE => 19, CcFilesPeer::COMMENTS => 20, CcFilesPeer::YEAR => 21, CcFilesPeer::TRACK_NUMBER => 22, CcFilesPeer::CHANNELS => 23, CcFilesPeer::URL => 24, CcFilesPeer::BPM => 25, CcFilesPeer::RATING => 26, CcFilesPeer::ENCODED_BY => 27, CcFilesPeer::DISC_NUMBER => 28, CcFilesPeer::MOOD => 29, CcFilesPeer::LABEL => 30, CcFilesPeer::COMPOSER => 31, CcFilesPeer::ENCODER => 32, CcFilesPeer::CHECKSUM => 33, CcFilesPeer::LYRICS => 34, CcFilesPeer::ORCHESTRA => 35, CcFilesPeer::CONDUCTOR => 36, CcFilesPeer::LYRICIST => 37, CcFilesPeer::ORIGINAL_LYRICIST => 38, CcFilesPeer::RADIO_STATION_NAME => 39, CcFilesPeer::INFO_URL => 40, CcFilesPeer::ARTIST_URL => 41, CcFilesPeer::AUDIO_SOURCE_URL => 42, CcFilesPeer::RADIO_STATION_URL => 43, CcFilesPeer::BUY_THIS_URL => 44, CcFilesPeer::ISRC_NUMBER => 45, CcFilesPeer::CATALOG_NUMBER => 46, CcFilesPeer::ORIGINAL_ARTIST => 47, CcFilesPeer::COPYRIGHT => 48, CcFilesPeer::REPORT_DATETIME => 49, CcFilesPeer::REPORT_LOCATION => 50, CcFilesPeer::REPORT_ORGANIZATION => 51, CcFilesPeer::SUBJECT => 52, CcFilesPeer::CONTRIBUTOR => 53, CcFilesPeer::LANGUAGE => 54, CcFilesPeer::FILE_EXISTS => 55, CcFilesPeer::REPLAY_GAIN => 56, CcFilesPeer::OWNER_ID => 57, CcFilesPeer::CUEIN => 58, CcFilesPeer::CUEOUT => 59, CcFilesPeer::SILAN_CHECK => 60, CcFilesPeer::HIDDEN => 61, CcFilesPeer::IS_SCHEDULED => 62, CcFilesPeer::IS_PLAYLIST => 63, CcFilesPeer::FILESIZE => 64, CcFilesPeer::DESCRIPTION => 65, CcFilesPeer::ARTWORK => 66, CcFilesPeer::TRACK_TYPE_ID => 67, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'FILEPATH' => 4, 'IMPORT_STATUS' => 5, 'CURRENTLYACCESSING' => 6, 'EDITEDBY' => 7, 'MTIME' => 8, 'UTIME' => 9, 'LPTIME' => 10, 'MD5' => 11, 'TRACK_TITLE' => 12, 'ARTIST_NAME' => 13, 'BIT_RATE' => 14, 'SAMPLE_RATE' => 15, 'FORMAT' => 16, 'LENGTH' => 17, 'ALBUM_TITLE' => 18, 'GENRE' => 19, 'COMMENTS' => 20, 'YEAR' => 21, 'TRACK_NUMBER' => 22, 'CHANNELS' => 23, 'URL' => 24, 'BPM' => 25, 'RATING' => 26, 'ENCODED_BY' => 27, 'DISC_NUMBER' => 28, 'MOOD' => 29, 'LABEL' => 30, 'COMPOSER' => 31, 'ENCODER' => 32, 'CHECKSUM' => 33, 'LYRICS' => 34, 'ORCHESTRA' => 35, 'CONDUCTOR' => 36, 'LYRICIST' => 37, 'ORIGINAL_LYRICIST' => 38, 'RADIO_STATION_NAME' => 39, 'INFO_URL' => 40, 'ARTIST_URL' => 41, 'AUDIO_SOURCE_URL' => 42, 'RADIO_STATION_URL' => 43, 'BUY_THIS_URL' => 44, 'ISRC_NUMBER' => 45, 'CATALOG_NUMBER' => 46, 'ORIGINAL_ARTIST' => 47, 'COPYRIGHT' => 48, 'REPORT_DATETIME' => 49, 'REPORT_LOCATION' => 50, 'REPORT_ORGANIZATION' => 51, 'SUBJECT' => 52, 'CONTRIBUTOR' => 53, 'LANGUAGE' => 54, 'FILE_EXISTS' => 55, 'REPLAY_GAIN' => 56, 'OWNER_ID' => 57, 'CUEIN' => 58, 'CUEOUT' => 59, 'SILAN_CHECK' => 60, 'HIDDEN' => 61, 'IS_SCHEDULED' => 62, 'IS_PLAYLIST' => 63, 'FILESIZE' => 64, 'DESCRIPTION' => 65, 'ARTWORK' => 66, 'TRACK_TYPE_ID' => 67, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'filepath' => 4, 'import_status' => 5, 'currentlyaccessing' => 6, 'editedby' => 7, 'mtime' => 8, 'utime' => 9, 'lptime' => 10, 'md5' => 11, 'track_title' => 12, 'artist_name' => 13, 'bit_rate' => 14, 'sample_rate' => 15, 'format' => 16, 'length' => 17, 'album_title' => 18, 'genre' => 19, 'comments' => 20, 'year' => 21, 'track_number' => 22, 'channels' => 23, 'url' => 24, 'bpm' => 25, 'rating' => 26, 'encoded_by' => 27, 'disc_number' => 28, 'mood' => 29, 'label' => 30, 'composer' => 31, 'encoder' => 32, 'checksum' => 33, 'lyrics' => 34, 'orchestra' => 35, 'conductor' => 36, 'lyricist' => 37, 'original_lyricist' => 38, 'radio_station_name' => 39, 'info_url' => 40, 'artist_url' => 41, 'audio_source_url' => 42, 'radio_station_url' => 43, 'buy_this_url' => 44, 'isrc_number' => 45, 'catalog_number' => 46, 'original_artist' => 47, 'copyright' => 48, 'report_datetime' => 49, 'report_location' => 50, 'report_organization' => 51, 'subject' => 52, 'contributor' => 53, 'language' => 54, 'file_exists' => 55, 'replay_gain' => 56, 'owner_id' => 57, 'cuein' => 58, 'cueout' => 59, 'silan_check' => 60, 'hidden' => 61, 'is_scheduled' => 62, 'is_playlist' => 63, 'filesize' => 64, 'description' => 65, 'artwork' => 66, 'track_type_id' => 67, ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, ) ); @@ -416,7 +416,7 @@ abstract class BaseCcFilesPeer $criteria->addSelectColumn(CcFilesPeer::FILESIZE); $criteria->addSelectColumn(CcFilesPeer::DESCRIPTION); $criteria->addSelectColumn(CcFilesPeer::ARTWORK); - $criteria->addSelectColumn(CcFilesPeer::TRACK_TYPE); + $criteria->addSelectColumn(CcFilesPeer::TRACK_TYPE_ID); } else { $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.name'); @@ -485,7 +485,7 @@ abstract class BaseCcFilesPeer $criteria->addSelectColumn($alias . '.filesize'); $criteria->addSelectColumn($alias . '.description'); $criteria->addSelectColumn($alias . '.artwork'); - $criteria->addSelectColumn($alias . '.track_type'); + $criteria->addSelectColumn($alias . '.track_type_id'); } } @@ -910,6 +910,57 @@ abstract class BaseCcFilesPeer } + /** + * Returns the number of rows matching criteria, joining the related CcTracktypes 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 doCountJoinCcTracktypes(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(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(CcFilesPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::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 CcFiles objects pre-filled with their CcSubjs objects. * @param Criteria $criteria @@ -1044,6 +1095,73 @@ abstract class BaseCcFilesPeer } + /** + * Selects a collection of CcFiles objects pre-filled with their CcTracktypes 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 CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcTracktypes(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(CcFilesPeer::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol = CcFilesPeer::NUM_HYDRATE_COLUMNS; + CcTracktypesPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcFilesPeer::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 = CcFilesPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcTracktypesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcTracktypesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcTracktypesPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcTracktypesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcFiles) to $obj2 (CcTracktypes) + $obj2->addCcFiles($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + /** * Returns the number of rows matching criteria, joining all related tables * @@ -1084,6 +1202,8 @@ abstract class BaseCcFilesPeer $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::ID, $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); if ($row = $stmt->fetch(PDO::FETCH_NUM)) { @@ -1124,10 +1244,15 @@ abstract class BaseCcFilesPeer CcSubjsPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; + CcTracktypesPeer::addSelectColumns($criteria); + $startcol5 = $startcol4 + CcTracktypesPeer::NUM_HYDRATE_COLUMNS; + $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior); $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::ID, $join_behavior); + $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -1181,6 +1306,24 @@ abstract class BaseCcFilesPeer $obj3->addCcFilesRelatedByDbEditedby($obj1); } // if joined row not null + // Add objects for joined CcTracktypes rows + + $key4 = CcTracktypesPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = CcTracktypesPeer::getInstanceFromPool($key4); + if (!$obj4) { + + $cls = CcTracktypesPeer::getOMClass(); + + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + CcTracktypesPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded + + // Add the $obj1 (CcFiles) to the collection in $obj4 (CcTracktypes) + $obj4->addCcFiles($obj1); + } // if joined row not null + $results[] = $obj1; } $stmt->closeCursor(); @@ -1225,6 +1368,8 @@ abstract class BaseCcFilesPeer $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); } + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::ID, $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); if ($row = $stmt->fetch(PDO::FETCH_NUM)) { @@ -1274,6 +1419,61 @@ abstract class BaseCcFilesPeer $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); } + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::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 CcTracktypes 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 doCountJoinAllExceptCcTracktypes(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(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(CcFilesPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior); + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + $stmt = BasePeer::doCount($criteria, $con); if ($row = $stmt->fetch(PDO::FETCH_NUM)) { @@ -1311,6 +1511,11 @@ abstract class BaseCcFilesPeer CcFilesPeer::addSelectColumns($criteria); $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS; + CcTracktypesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + CcTracktypesPeer::NUM_HYDRATE_COLUMNS; + + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::ID, $join_behavior); + $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -1329,6 +1534,25 @@ abstract class BaseCcFilesPeer CcFilesPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded + // Add objects for joined CcTracktypes rows + + $key2 = CcTracktypesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcTracktypesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcTracktypesPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcTracktypesPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcFiles) to the collection in $obj2 (CcTracktypes) + $obj2->addCcFiles($obj1); + + } // if joined row is not null + $results[] = $obj1; } $stmt->closeCursor(); @@ -1361,6 +1585,11 @@ abstract class BaseCcFilesPeer CcFilesPeer::addSelectColumns($criteria); $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS; + CcTracktypesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + CcTracktypesPeer::NUM_HYDRATE_COLUMNS; + + $criteria->addJoin(CcFilesPeer::TRACK_TYPE_ID, CcTracktypesPeer::ID, $join_behavior); + $stmt = BasePeer::doSelect($criteria, $con); $results = array(); @@ -1379,6 +1608,123 @@ abstract class BaseCcFilesPeer CcFilesPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded + // Add objects for joined CcTracktypes rows + + $key2 = CcTracktypesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcTracktypesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcTracktypesPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcTracktypesPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcFiles) to the collection in $obj2 (CcTracktypes) + $obj2->addCcFiles($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + + /** + * Selects a collection of CcFiles objects pre-filled with all related objects except CcTracktypes. + * + * @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 CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcTracktypes(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(CcFilesPeer::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS; + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; + + CcSubjsPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; + + $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior); + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcFilesPeer::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 = CcFilesPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::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 (CcFiles) to the collection in $obj2 (CcSubjs) + $obj2->addCcFilesRelatedByDbOwnerId($obj1); + + } // if joined row is 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 already loaded + + // Add the $obj1 (CcFiles) to the collection in $obj3 (CcSubjs) + $obj3->addCcFilesRelatedByDbEditedby($obj1); + + } // if joined row is not null + $results[] = $obj1; } $stmt->closeCursor(); diff --git a/legacy/application/models/airtime/om/BaseCcFilesQuery.php b/legacy/application/models/airtime/om/BaseCcFilesQuery.php index 2497a5e45..078ae8a71 100644 --- a/legacy/application/models/airtime/om/BaseCcFilesQuery.php +++ b/legacy/application/models/airtime/om/BaseCcFilesQuery.php @@ -73,7 +73,7 @@ * @method CcFilesQuery orderByDbFilesize($order = Criteria::ASC) Order by the filesize column * @method CcFilesQuery orderByDbDescription($order = Criteria::ASC) Order by the description column * @method CcFilesQuery orderByDbArtwork($order = Criteria::ASC) Order by the artwork column - * @method CcFilesQuery orderByDbTrackType($order = Criteria::ASC) Order by the track_type column + * @method CcFilesQuery orderByDbTrackTypeId($order = Criteria::ASC) Order by the track_type_id column * * @method CcFilesQuery groupByDbId() Group by the id column * @method CcFilesQuery groupByDbName() Group by the name column @@ -142,7 +142,7 @@ * @method CcFilesQuery groupByDbFilesize() Group by the filesize column * @method CcFilesQuery groupByDbDescription() Group by the description column * @method CcFilesQuery groupByDbArtwork() Group by the artwork column - * @method CcFilesQuery groupByDbTrackType() Group by the track_type column + * @method CcFilesQuery groupByDbTrackTypeId() Group by the track_type_id column * * @method CcFilesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -156,6 +156,10 @@ * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * @method CcFilesQuery innerJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * + * @method CcFilesQuery leftJoinCcTracktypes($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcTracktypes relation + * @method CcFilesQuery rightJoinCcTracktypes($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcTracktypes relation + * @method CcFilesQuery innerJoinCcTracktypes($relationAlias = null) Adds a INNER JOIN clause to the query using the CcTracktypes relation + * * @method CcFilesQuery leftJoinCcShowInstances($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstances relation * @method CcFilesQuery rightJoinCcShowInstances($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstances relation * @method CcFilesQuery innerJoinCcShowInstances($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstances relation @@ -253,7 +257,7 @@ * @method CcFiles findOneByDbFilesize(int $filesize) Return the first CcFiles filtered by the filesize column * @method CcFiles findOneByDbDescription(string $description) Return the first CcFiles filtered by the description column * @method CcFiles findOneByDbArtwork(string $artwork) Return the first CcFiles filtered by the artwork column - * @method CcFiles findOneByDbTrackType(string $track_type) Return the first CcFiles filtered by the track_type column + * @method CcFiles findOneByDbTrackTypeId(int $track_type_id) Return the first CcFiles filtered by the track_type_id column * * @method array findByDbId(int $id) Return CcFiles objects filtered by the id column * @method array findByDbName(string $name) Return CcFiles objects filtered by the name column @@ -322,7 +326,7 @@ * @method array findByDbFilesize(int $filesize) Return CcFiles objects filtered by the filesize column * @method array findByDbDescription(string $description) Return CcFiles objects filtered by the description column * @method array findByDbArtwork(string $artwork) Return CcFiles objects filtered by the artwork column - * @method array findByDbTrackType(string $track_type) Return CcFiles objects filtered by the track_type column + * @method array findByDbTrackTypeId(int $track_type_id) Return CcFiles objects filtered by the track_type_id column * * @package propel.generator.airtime.om */ @@ -430,7 +434,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "name", "mime", "ftype", "filepath", "import_status", "currentlyaccessing", "editedby", "mtime", "utime", "lptime", "md5", "track_title", "artist_name", "bit_rate", "sample_rate", "format", "length", "album_title", "genre", "comments", "year", "track_number", "channels", "url", "bpm", "rating", "encoded_by", "disc_number", "mood", "label", "composer", "encoder", "checksum", "lyrics", "orchestra", "conductor", "lyricist", "original_lyricist", "radio_station_name", "info_url", "artist_url", "audio_source_url", "radio_station_url", "buy_this_url", "isrc_number", "catalog_number", "original_artist", "copyright", "report_datetime", "report_location", "report_organization", "subject", "contributor", "language", "file_exists", "replay_gain", "owner_id", "cuein", "cueout", "silan_check", "hidden", "is_scheduled", "is_playlist", "filesize", "description", "artwork", "track_type" FROM "cc_files" WHERE "id" = :p0'; + $sql = 'SELECT "id", "name", "mime", "ftype", "filepath", "import_status", "currentlyaccessing", "editedby", "mtime", "utime", "lptime", "md5", "track_title", "artist_name", "bit_rate", "sample_rate", "format", "length", "album_title", "genre", "comments", "year", "track_number", "channels", "url", "bpm", "rating", "encoded_by", "disc_number", "mood", "label", "composer", "encoder", "checksum", "lyrics", "orchestra", "conductor", "lyricist", "original_lyricist", "radio_station_name", "info_url", "artist_url", "audio_source_url", "radio_station_url", "buy_this_url", "isrc_number", "catalog_number", "original_artist", "copyright", "report_datetime", "report_location", "report_organization", "subject", "contributor", "language", "file_exists", "replay_gain", "owner_id", "cuein", "cueout", "silan_check", "hidden", "is_scheduled", "is_playlist", "filesize", "description", "artwork", "track_type_id" FROM "cc_files" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -2655,32 +2659,47 @@ abstract class BaseCcFilesQuery extends ModelCriteria } /** - * Filter the query on the track_type column + * Filter the query on the track_type_id column * * Example usage: * - * $query->filterByDbTrackType('fooValue'); // WHERE track_type = 'fooValue' - * $query->filterByDbTrackType('%fooValue%'); // WHERE track_type LIKE '%fooValue%' + * $query->filterByDbTrackTypeId(1234); // WHERE track_type_id = 1234 + * $query->filterByDbTrackTypeId(array(12, 34)); // WHERE track_type_id IN (12, 34) + * $query->filterByDbTrackTypeId(array('min' => 12)); // WHERE track_type_id >= 12 + * $query->filterByDbTrackTypeId(array('max' => 12)); // WHERE track_type_id <= 12 * * - * @param string $dbTrackType The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) + * @see filterByCcTracktypes() + * + * @param mixed $dbTrackTypeId 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 CcFilesQuery The current query, for fluid interface */ - public function filterByDbTrackType($dbTrackType = null, $comparison = null) + public function filterByDbTrackTypeId($dbTrackTypeId = null, $comparison = null) { - if (null === $comparison) { - if (is_array($dbTrackType)) { + if (is_array($dbTrackTypeId)) { + $useMinMax = false; + if (isset($dbTrackTypeId['min'])) { + $this->addUsingAlias(CcFilesPeer::TRACK_TYPE_ID, $dbTrackTypeId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbTrackTypeId['max'])) { + $this->addUsingAlias(CcFilesPeer::TRACK_TYPE_ID, $dbTrackTypeId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbTrackType)) { - $dbTrackType = str_replace('*', '%', $dbTrackType); - $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(CcFilesPeer::TRACK_TYPE, $dbTrackType, $comparison); + return $this->addUsingAlias(CcFilesPeer::TRACK_TYPE_ID, $dbTrackTypeId, $comparison); } /** @@ -2835,6 +2854,82 @@ abstract class BaseCcFilesQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByDbEditedby', 'CcSubjsQuery'); } + /** + * Filter the query by a related CcTracktypes object + * + * @param CcTracktypes|PropelObjectCollection $ccTracktypes The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByCcTracktypes($ccTracktypes, $comparison = null) + { + if ($ccTracktypes instanceof CcTracktypes) { + return $this + ->addUsingAlias(CcFilesPeer::TRACK_TYPE_ID, $ccTracktypes->getDbId(), $comparison); + } elseif ($ccTracktypes instanceof PropelObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(CcFilesPeer::TRACK_TYPE_ID, $ccTracktypes->toKeyValue('PrimaryKey', 'DbId'), $comparison); + } else { + throw new PropelException('filterByCcTracktypes() only accepts arguments of type CcTracktypes or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the CcTracktypes relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function joinCcTracktypes($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcTracktypes'); + + // 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, 'CcTracktypes'); + } + + return $this; + } + + /** + * Use the CcTracktypes relation CcTracktypes 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 CcTracktypesQuery A secondary query class using the current class as primary query + */ + public function useCcTracktypesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcTracktypes($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcTracktypes', 'CcTracktypesQuery'); + } + /** * Filter the query by a related CcShowInstances object * diff --git a/legacy/application/models/airtime/om/BaseCcSubjs.php b/legacy/application/models/airtime/om/BaseCcSubjs.php index 63153f3fc..857857205 100644 --- a/legacy/application/models/airtime/om/BaseCcSubjs.php +++ b/legacy/application/models/airtime/om/BaseCcSubjs.php @@ -2146,6 +2146,31 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent 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 CcFilessRelatedByDbOwnerId 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|CcFiles[] List of CcFiles objects + */ + public function getCcFilessRelatedByDbOwnerIdJoinCcTracktypes($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcFilesQuery::create(null, $criteria); + $query->joinWith('CcTracktypes', $join_behavior); + + return $this->getCcFilessRelatedByDbOwnerId($query, $con); + } + /** * Clears out the collCcFilessRelatedByDbEditedby collection * @@ -2371,6 +2396,31 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent 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 CcFilessRelatedByDbEditedby 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|CcFiles[] List of CcFiles objects + */ + public function getCcFilessRelatedByDbEditedbyJoinCcTracktypes($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcFilesQuery::create(null, $criteria); + $query->joinWith('CcTracktypes', $join_behavior); + + return $this->getCcFilessRelatedByDbEditedby($query, $con); + } + /** * Clears out the collCcShowHostss collection * diff --git a/legacy/application/models/airtime/om/BaseCcTracktypes.php b/legacy/application/models/airtime/om/BaseCcTracktypes.php index 6d5069b7b..6d9b38f28 100644 --- a/legacy/application/models/airtime/om/BaseCcTracktypes.php +++ b/legacy/application/models/airtime/om/BaseCcTracktypes.php @@ -63,6 +63,12 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent */ protected $description; + /** + * @var PropelObjectCollection|CcFiles[] Collection to store aggregation of CcFiles objects. + */ + protected $collCcFiless; + protected $collCcFilessPartial; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -83,6 +89,12 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent */ protected $alreadyInClearAllReferencesDeep = false; + /** + * An array of objects scheduled for deletion. + * @var PropelObjectCollection + */ + protected $ccFilessScheduledForDeletion = null; + /** * Applies default values to this object. * This method should be called from the object's constructor (or @@ -399,6 +411,8 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? + $this->collCcFiless = null; + } // if (deep) } @@ -523,6 +537,24 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent $this->resetModified(); } + if ($this->ccFilessScheduledForDeletion !== null) { + if (!$this->ccFilessScheduledForDeletion->isEmpty()) { + foreach ($this->ccFilessScheduledForDeletion as $ccFiles) { + // need to save related object because we set the relation to null + $ccFiles->save($con); + } + $this->ccFilessScheduledForDeletion = null; + } + } + + if ($this->collCcFiless !== null) { + foreach ($this->collCcFiless as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -692,6 +724,14 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent } + if ($this->collCcFiless !== null) { + foreach ($this->collCcFiless as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -759,10 +799,11 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent * 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()) + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['CcTracktypes'][$this->getPrimaryKey()])) { return '*RECURSION*'; @@ -781,6 +822,11 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent $result[$key] = $virtualColumn; } + if ($includeForeignObjects) { + if (null !== $this->collCcFiless) { + $result['CcFiless'] = $this->collCcFiless->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + } return $result; } @@ -941,6 +987,24 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent $copyObj->setDbVisibility($this->getDbVisibility()); $copyObj->setDbTypeName($this->getDbTypeName()); $copyObj->setDbDescription($this->getDbDescription()); + + 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; + + foreach ($this->getCcFiless() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcFiles($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 @@ -987,6 +1051,297 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent return self::$peer; } + + /** + * Initializes a collection based on the name of a relation. + * Avoids crafting an 'init[$relationName]s' method name + * that wouldn't work when StandardEnglishPluralizer is used. + * + * @param string $relationName The name of the relation to initialize + * @return void + */ + public function initRelation($relationName) + { + if ('CcFiles' == $relationName) { + $this->initCcFiless(); + } + } + + /** + * Clears out the collCcFiless 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 CcTracktypes The current object (for fluent API support) + * @see addCcFiless() + */ + public function clearCcFiless() + { + $this->collCcFiless = null; // important to set this to null since that means it is uninitialized + $this->collCcFilessPartial = null; + + return $this; + } + + /** + * reset is the collCcFiless collection loaded partially + * + * @return void + */ + public function resetPartialCcFiless($v = true) + { + $this->collCcFilessPartial = $v; + } + + /** + * Initializes the collCcFiless collection. + * + * By default this just sets the collCcFiless collection to an empty array (like clearcollCcFiless()); + * 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 initCcFiless($overrideExisting = true) + { + if (null !== $this->collCcFiless && !$overrideExisting) { + return; + } + $this->collCcFiless = new PropelObjectCollection(); + $this->collCcFiless->setModel('CcFiles'); + } + + /** + * Gets an array of CcFiles 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 CcTracktypes 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|CcFiles[] List of CcFiles objects + * @throws PropelException + */ + public function getCcFiless($criteria = null, PropelPDO $con = null) + { + $partial = $this->collCcFilessPartial && !$this->isNew(); + if (null === $this->collCcFiless || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCcFiless) { + // return empty collection + $this->initCcFiless(); + } else { + $collCcFiless = CcFilesQuery::create(null, $criteria) + ->filterByCcTracktypes($this) + ->find($con); + if (null !== $criteria) { + if (false !== $this->collCcFilessPartial && count($collCcFiless)) { + $this->initCcFiless(false); + + foreach ($collCcFiless as $obj) { + if (false == $this->collCcFiless->contains($obj)) { + $this->collCcFiless->append($obj); + } + } + + $this->collCcFilessPartial = true; + } + + $collCcFiless->getInternalIterator()->rewind(); + + return $collCcFiless; + } + + if ($partial && $this->collCcFiless) { + foreach ($this->collCcFiless as $obj) { + if ($obj->isNew()) { + $collCcFiless[] = $obj; + } + } + } + + $this->collCcFiless = $collCcFiless; + $this->collCcFilessPartial = false; + } + } + + return $this->collCcFiless; + } + + /** + * Sets a collection of CcFiles 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 $ccFiless A Propel collection. + * @param PropelPDO $con Optional connection object + * @return CcTracktypes The current object (for fluent API support) + */ + public function setCcFiless(PropelCollection $ccFiless, PropelPDO $con = null) + { + $ccFilessToDelete = $this->getCcFiless(new Criteria(), $con)->diff($ccFiless); + + + $this->ccFilessScheduledForDeletion = $ccFilessToDelete; + + foreach ($ccFilessToDelete as $ccFilesRemoved) { + $ccFilesRemoved->setCcTracktypes(null); + } + + $this->collCcFiless = null; + foreach ($ccFiless as $ccFiles) { + $this->addCcFiles($ccFiles); + } + + $this->collCcFiless = $ccFiless; + $this->collCcFilessPartial = false; + + return $this; + } + + /** + * Returns the number of related CcFiles objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcFiles objects. + * @throws PropelException + */ + public function countCcFiless(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + $partial = $this->collCcFilessPartial && !$this->isNew(); + if (null === $this->collCcFiless || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCcFiless) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getCcFiless()); + } + $query = CcFilesQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByCcTracktypes($this) + ->count($con); + } + + return count($this->collCcFiless); + } + + /** + * Method called to associate a CcFiles object to this object + * through the CcFiles foreign key attribute. + * + * @param CcFiles $l CcFiles + * @return CcTracktypes The current object (for fluent API support) + */ + public function addCcFiles(CcFiles $l) + { + if ($this->collCcFiless === null) { + $this->initCcFiless(); + $this->collCcFilessPartial = true; + } + + if (!in_array($l, $this->collCcFiless->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddCcFiles($l); + + if ($this->ccFilessScheduledForDeletion and $this->ccFilessScheduledForDeletion->contains($l)) { + $this->ccFilessScheduledForDeletion->remove($this->ccFilessScheduledForDeletion->search($l)); + } + } + + return $this; + } + + /** + * @param CcFiles $ccFiles The ccFiles object to add. + */ + protected function doAddCcFiles($ccFiles) + { + $this->collCcFiless[]= $ccFiles; + $ccFiles->setCcTracktypes($this); + } + + /** + * @param CcFiles $ccFiles The ccFiles object to remove. + * @return CcTracktypes The current object (for fluent API support) + */ + public function removeCcFiles($ccFiles) + { + if ($this->getCcFiless()->contains($ccFiles)) { + $this->collCcFiless->remove($this->collCcFiless->search($ccFiles)); + if (null === $this->ccFilessScheduledForDeletion) { + $this->ccFilessScheduledForDeletion = clone $this->collCcFiless; + $this->ccFilessScheduledForDeletion->clear(); + } + $this->ccFilessScheduledForDeletion[]= $ccFiles; + $ccFiles->setCcTracktypes(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcTracktypes is new, it will return + * an empty collection; or if this CcTracktypes has previously + * been saved, it will retrieve related CcFiless 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 CcTracktypes. + * + * @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|CcFiles[] List of CcFiles objects + */ + public function getCcFilessJoinFkOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcFilesQuery::create(null, $criteria); + $query->joinWith('FkOwner', $join_behavior); + + return $this->getCcFiless($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcTracktypes is new, it will return + * an empty collection; or if this CcTracktypes has previously + * been saved, it will retrieve related CcFiless 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 CcTracktypes. + * + * @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|CcFiles[] List of CcFiles objects + */ + public function getCcFilessJoinCcSubjsRelatedByDbEditedby($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcFilesQuery::create(null, $criteria); + $query->joinWith('CcSubjsRelatedByDbEditedby', $join_behavior); + + return $this->getCcFiless($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -1020,10 +1375,19 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; + if ($this->collCcFiless) { + foreach ($this->collCcFiless as $o) { + $o->clearAllReferences($deep); + } + } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) + if ($this->collCcFiless instanceof PropelCollection) { + $this->collCcFiless->clearIterator(); + } + $this->collCcFiless = null; } /** diff --git a/legacy/application/models/airtime/om/BaseCcTracktypesQuery.php b/legacy/application/models/airtime/om/BaseCcTracktypesQuery.php index 87ffbcd52..95f390d12 100644 --- a/legacy/application/models/airtime/om/BaseCcTracktypesQuery.php +++ b/legacy/application/models/airtime/om/BaseCcTracktypesQuery.php @@ -22,6 +22,10 @@ * @method CcTracktypesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcTracktypesQuery innerJoin($relation) Adds a INNER JOIN clause to the query * + * @method CcTracktypesQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation + * @method CcTracktypesQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation + * @method CcTracktypesQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation + * * @method CcTracktypes findOne(PropelPDO $con = null) Return the first CcTracktypes matching the query * @method CcTracktypes findOneOrCreate(PropelPDO $con = null) Return the first CcTracktypes matching the query, or a new CcTracktypes object populated from the query conditions when no match is found * @@ -387,6 +391,80 @@ abstract class BaseCcTracktypesQuery extends ModelCriteria return $this->addUsingAlias(CcTracktypesPeer::DESCRIPTION, $dbDescription, $comparison); } + /** + * Filter the query by a related CcFiles object + * + * @param CcFiles|PropelObjectCollection $ccFiles the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTracktypesQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByCcFiles($ccFiles, $comparison = null) + { + if ($ccFiles instanceof CcFiles) { + return $this + ->addUsingAlias(CcTracktypesPeer::ID, $ccFiles->getDbTrackTypeId(), $comparison); + } elseif ($ccFiles instanceof PropelObjectCollection) { + return $this + ->useCcFilesQuery() + ->filterByPrimaryKeys($ccFiles->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the CcFiles relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcTracktypesQuery The current query, for fluid interface + */ + public function joinCcFiles($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcFiles'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcFiles'); + } + + return $this; + } + + /** + * Use the CcFiles relation CcFiles object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcFilesQuery A secondary query class using the current class as primary query + */ + public function useCcFilesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcFiles($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + } + /** * Exclude object from result * diff --git a/legacy/application/views/scripts/plupload/index.phtml b/legacy/application/views/scripts/plupload/index.phtml index b452acc5d..c0adafd46 100644 --- a/legacy/application/views/scripts/plupload/index.phtml +++ b/legacy/application/views/scripts/plupload/index.phtml @@ -47,12 +47,12 @@ echo ""; foreach ($tracktypes as $key => $tt) { $selected = ""; - if ($ttsaved == $tt['code']) { + if ($ttsaved == $tt['id']) { $selected = "selected"; } - $code = $tt['code']; + $id = $tt['id']; $typename = $tt['type_name']; - echo ""; + echo ""; } ?> @@ -64,7 +64,7 @@ if ($showTracktypesDropdown) { $ttTitle = ""; foreach ($tracktypes as $key => $tt) { - if ($ttsaved == $tt['code']) { + if ($ttsaved == $tt['id']) { $ttTitle = $tt['type_name']; } } diff --git a/legacy/build/schema.xml b/legacy/build/schema.xml index c694f085d..dc5cbdde5 100644 --- a/legacy/build/schema.xml +++ b/legacy/build/schema.xml @@ -69,13 +69,16 @@ - + + + + diff --git a/legacy/public/js/airtime/library/library.js b/legacy/public/js/airtime/library/library.js index f5e1f87f2..0640de2af 100644 --- a/legacy/public/js/airtime/library/library.js +++ b/legacy/public/js/airtime/library/library.js @@ -55,7 +55,7 @@ var AIRTIME = (function (AIRTIME) { "info_url": "s", "replay_gain": "n", "artwork": "s", - "track_type": "tt" + "track_type_id": "tt" }; if (AIRTIME.library === undefined) { @@ -591,7 +591,7 @@ var AIRTIME = (function (AIRTIME) { /* Cue Out */ { "sTitle": $.i18n._("Cue Out"), "mDataProp": "cueout", "bVisible": false, "sClass": "library_length", "sWidth": "80px" }, /* Description */ { "sTitle": $.i18n._("Description"), "mDataProp": "description", "bVisible": false, "sClass": "library_description", "sWidth": "150px" }, /* Encoded */ { "sTitle": $.i18n._("Encoded By"), "mDataProp": "encoded_by", "bVisible": false, "sClass": "library_encoded", "sWidth": "150px" }, - /* Track Type */ { "sTitle": $.i18n._("Type"), "mDataProp": "track_type", "sClass": "library_track_type", "sWidth": "60px" }, + /* Track Type */ { "sTitle": $.i18n._("Type"), "mDataProp": "track_type_id", "sClass": "library_track_type", "sWidth": "60px" }, /* Genre */ { "sTitle": $.i18n._("Genre"), "mDataProp": "genre", "sClass": "library_genre", "sWidth": "100px" }, /* ISRC Number */ { "sTitle": $.i18n._("ISRC"), "mDataProp": "isrc_number", "bVisible": false, "sClass": "library_isrc", "sWidth": "150px" }, /* Label */ { "sTitle": $.i18n._("Label"), "mDataProp": "label", "bVisible": false, "sClass": "library_label", "sWidth": "125px" }, @@ -766,12 +766,12 @@ var AIRTIME = (function (AIRTIME) { $(this).contextMenu({ x: $(e.target).offset().left, y: $(e.target).offset().top }) }).html("
...
"); - if (aData.track_type == null || aData.track_type == undefined || aData.track_type == 0) { + if (aData.track_type_id == null || aData.track_type_id == undefined || aData.track_type_id == 0) { var has_type = false; var type_button = ""; } else { var has_type = true; - var type_button = "
" + aData.track_type + "
"; + var type_button = "
" + TRACKTYPES[aData.track_type_id].code + "
"; } $(nRow).find('td.library_track_type') @@ -782,8 +782,7 @@ var AIRTIME = (function (AIRTIME) { function (json) { var type_enabled = false; $.each(json, function (key, value) { - - if (value['code'] == aData.track_type) { + if (value['id'] == aData.track_type_id) { $("#au_" + aData.id + " td.library_track_type div.library_track_type_btn").qtip({ overwrite: false, content: { @@ -1645,7 +1644,7 @@ var validationTypes = { "track_number": "i", "info_url": "s", "artwork": "s", - "track_type": "s", + "track_type_id": "s", "year": "i" }; @@ -1657,10 +1656,10 @@ function tracktypesJson() { jQuery.getJSON( baseUrl + "api/track-types", function (json) { - var ttSelect = $('#track_type .filter_select .select_filter'); + var ttSelect = $('#track_type_id .filter_select .select_filter'); $.each(json, function (key, value) { var option = $("