From 23e3f6137d30df91a0a8736d7b7d7ba7fae50e55 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 10:21:39 -0400 Subject: [PATCH 01/23] cc-3936: Sexified code. Added section for user handling. --- airtime_mvc/application/models/StoredFile.php | 116 +++++++++--------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 9be0e51b0..f2ba5d81f 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -24,30 +24,30 @@ class Application_Model_StoredFile * array of db metadata -> propel */ private $_dbMD = array ( - "track_title" => "DbTrackTitle", - "artist_name" => "DbArtistName", - "album_title" => "DbAlbumTitle", - "genre" => "DbGenre", - "mood" => "DbMood", + "track_title" => "DbTrackTitle", + "artist_name" => "DbArtistName", + "album_title" => "DbAlbumTitle", + "genre" => "DbGenre", + "mood" => "DbMood", "track_number" => "DbTrackNumber", - "bpm" => "DbBpm", - "label" => "DbLabel", - "composer" => "DbComposer", - "encoded_by" => "DbEncodedBy", - "conductor" => "DbConductor", - "year" => "DbYear", - "info_url" => "DbInfoUrl", - "isrc_number" => "DbIsrcNumber", - "copyright" => "DbCopyright", - "length" => "DbLength", - "bit_rate" => "DbBitRate", - "sample_rate" => "DbSampleRate", - "mime" => "DbMime", - "md5" => "DbMd5", - "ftype" => "DbFtype", - "language" => "DbLanguage", - "replay_gain" => "DbReplayGain", - "directory" => "DbDirectory" + "bpm" => "DbBpm", + "label" => "DbLabel", + "composer" => "DbComposer", + "encoded_by" => "DbEncodedBy", + "conductor" => "DbConductor", + "year" => "DbYear", + "info_url" => "DbInfoUrl", + "isrc_number" => "DbIsrcNumber", + "copyright" => "DbCopyright", + "length" => "DbLength", + "bit_rate" => "DbBitRate", + "sample_rate" => "DbSampleRate", + "mime" => "DbMime", + "md5" => "DbMd5", + "ftype" => "DbFtype", + "language" => "DbLanguage", + "replay_gain" => "DbReplayGain", + "directory" => "DbDirectory" ); public function __construct() @@ -266,8 +266,8 @@ class Application_Model_StoredFile foreach ($c['user'] as $constant => $value) { if (preg_match('/^MDATA_KEY/', $constant)) { if (isset($dbmd_copy[$value])) { - $propelColumn = $dbmd_copy[$value]; - $method = "get$propelColumn"; + $propelColumn = $dbmd_copy[$value]; + $method = "get$propelColumn"; $md[$constant] = $this->_file->$method(); } } @@ -594,31 +594,31 @@ class Application_Model_StoredFile "language", "filepath" ); - $plSelect = array(); - $blSelect = array(); - $fileSelect = array(); + $plSelect = array(); + $blSelect = array(); + $fileSelect = array(); $streamSelect = array(); foreach ($displayColumns as $key) { if ($key === "id") { - $plSelect[] = "PL.id AS ".$key; - $blSelect[] = "BL.id AS ".$key; - $fileSelect[] = $key; + $plSelect[] = "PL.id AS ".$key; + $blSelect[] = "BL.id AS ".$key; + $fileSelect[] = $key; $streamSelect[] = "ws.id AS ".$key; } elseif ($key === "track_title") { - $plSelect[] = "name AS ".$key; - $blSelect[] = "name AS ".$key; - $fileSelect[] = $key; + $plSelect[] = "name AS ".$key; + $blSelect[] = "name AS ".$key; + $fileSelect[] = $key; $streamSelect[] = "name AS ".$key; } elseif ($key === "ftype") { - $plSelect[] = "'playlist'::varchar AS ".$key; - $blSelect[] = "'block'::varchar AS ".$key; - $fileSelect[] = $key; + $plSelect[] = "'playlist'::varchar AS ".$key; + $blSelect[] = "'block'::varchar AS ".$key; + $fileSelect[] = $key; $streamSelect[] = "'stream'::varchar AS ".$key; } elseif ($key === "artist_name") { - $plSelect[] = "login AS ".$key; - $blSelect[] = "login AS ".$key; - $fileSelect[] = $key; + $plSelect[] = "login AS ".$key; + $blSelect[] = "login AS ".$key; + $fileSelect[] = $key; $streamSelect[] = "login AS ".$key; } //same columns in each table. @@ -635,26 +635,26 @@ class Application_Model_StoredFile } //need to cast certain data as ints for the union to search on. else if (in_array($key, array("track_number", "bit_rate", "sample_rate", "bpm"))) { - $plSelect[] = "NULL::int AS ".$key; - $blSelect[] = "NULL::int AS ".$key; - $fileSelect[] = $key; + $plSelect[] = "NULL::int AS ".$key; + $blSelect[] = "NULL::int AS ".$key; + $fileSelect[] = $key; $streamSelect[] = "NULL::int AS ".$key; } else if ($key === "filepath") { - $plSelect[] = "NULL::VARCHAR AS ".$key; - $blSelect[] = "NULL::VARCHAR AS ".$key; - $fileSelect[] = $key; + $plSelect[] = "NULL::VARCHAR AS ".$key; + $blSelect[] = "NULL::VARCHAR AS ".$key; + $fileSelect[] = $key; $streamSelect[] = "url AS ".$key; } else { - $plSelect[] = "NULL::text AS ".$key; - $blSelect[] = "NULL::text AS ".$key; - $fileSelect[] = $key; + $plSelect[] = "NULL::text AS ".$key; + $blSelect[] = "NULL::text AS ".$key; + $fileSelect[] = $key; $streamSelect[] = "NULL::text AS ".$key; } } - $plSelect = "SELECT ". join(",", $plSelect); - $blSelect = "SELECT ". join(",", $blSelect); - $fileSelect = "SELECT ". join(",", $fileSelect); + $plSelect = "SELECT ". join(",", $plSelect); + $blSelect = "SELECT ". join(",", $blSelect); + $fileSelect = "SELECT ". join(",", $fileSelect); $streamSelect = "SELECT ". join(",", $streamSelect); $type = intval($datatables["type"]); @@ -881,8 +881,8 @@ class Application_Model_StoredFile // Check if liquidsoap can play this file if(!self::liquidsoapFilePlayabilityTest($audio_file)) { return array( - "code" => 110, - "message" => "This file appears to be corrupted and will not + "code" => 110, + "message" => "This file appears to be corrupted and will not be added to media library."); } @@ -895,12 +895,18 @@ class Application_Model_StoredFile #warn the user that the file wasn't uploaded and they should check if there is enough disk space. unlink($audio_file);//remove the file after failed rename return array( - "code" => 108, + "code" => 108, "message" => " The file was not uploaded, this error can occur if the computer hard drive does not have enough disk space or the stor directory does not have correct write permissions. "); } + // Now that we successfully added this file, we will add another tag + // file that will identify the user that owns it + $uid = Application_Model_User::getCurrentUser()->getId(); + if (file_put_contents($audio_stor,$uid) === false) { + Logging::info("Could write file to identify user: '$uid'"); + } return null; } From f940c2070139cbd4c8cc8fd3f5ce6bfea483ecc4 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 11:13:03 -0400 Subject: [PATCH 02/23] cc-3936: Added success logging when identifier file has been written. --- airtime_mvc/application/models/StoredFile.php | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index f2ba5d81f..5eb13631e 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -873,9 +873,9 @@ class Application_Model_StoredFile if(!self::isEnoughDiskSpaceToCopy($stor, $audio_file)) { $freeSpace = disk_free_space($stor); return array("code" => 107, - "message" => "The file was not uploaded, there is - ".$freeSpace."MB of disk space left and the file you are - uploading has a size of ".$fileSize."MB."); + "message" => "The file was not uploaded, there is + ".$freeSpace."MB of disk space left and the file you are + uploading has a size of ".$fileSize."MB."); } // Check if liquidsoap can play this file @@ -889,23 +889,31 @@ class Application_Model_StoredFile // Did all the checks for realz, now trying to copy $audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName); Logging::info("copyFileToStor: moving file $audio_file to $audio_stor"); - //Martin K.: changed to rename: Much less load + quicker since this is an atomic operation + // Martin K.: changed to rename: Much less load + quicker since this is + // an atomic operation if (@rename($audio_file, $audio_stor) === false) { - #something went wrong likely there wasn't enough space in the audio_stor to move the file too. - #warn the user that the file wasn't uploaded and they should check if there is enough disk space. - unlink($audio_file);//remove the file after failed rename + //something went wrong likely there wasn't enough space in the audio_stor to move the file too. + //warn the user that the file wasn't uploaded and they should check if there is enough disk space. + unlink($audio_file); //remove the file after failed rename return array( "code" => 108, "message" => " The file was not uploaded, this error can occur if the computer hard drive does not have enough disk space or the stor - directory does not have correct write permissions. "); + directory does not have correct write permissions."); } // Now that we successfully added this file, we will add another tag // file that will identify the user that owns it $uid = Application_Model_User::getCurrentUser()->getId(); - if (file_put_contents($audio_stor,$uid) === false) { - Logging::info("Could write file to identify user: '$uid'"); + $id_file = "$audio_stor.identifier"; + if (file_put_contents($id_file,$uid) === false) { + Logging::info("Could not write file to identify user: '$uid'"); + Logging::info("Id file path: '$id_file'"); + Logging::info("Defaulting to admin (no identification file was + written)"); + } else { + Logging::info("Successfully written identification file for + uploaded '$audio_stor'"); } return null; } From 4f88543de2ba495078b6c1bf9666b47820414ac5 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 11:13:54 -0400 Subject: [PATCH 03/23] cc-3936: Updated schema so that every file has an owner. --- airtime_mvc/build/schema.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 6b9536de8..25cd4d716 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -75,6 +75,10 @@ + + + + From dcfa865f7d2ae7903c3ef0bf1ba665fe3ec68246 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 11:45:57 -0400 Subject: [PATCH 04/23] cc-3936: Ran propel-gen to commit schema changes. --- .../application/configs/airtime-conf.php | 2 +- .../models/airtime/map/CcFilesTableMap.php | 4 +- .../models/airtime/map/CcSubjsTableMap.php | 3 +- .../models/airtime/om/BaseCcFiles.php | 181 +++++++-- .../models/airtime/om/BaseCcFilesPeer.php | 363 ++++++++++++++++-- .../models/airtime/om/BaseCcFilesQuery.php | 129 ++++++- .../models/airtime/om/BaseCcMusicDirs.php | 29 +- .../models/airtime/om/BaseCcSubjs.php | 255 +++++++++--- .../models/airtime/om/BaseCcSubjsQuery.php | 94 ++++- airtime_mvc/build/build.properties | 2 +- airtime_mvc/build/schema.xml | 4 +- airtime_mvc/build/sql/schema.sql | 3 + 12 files changed, 931 insertions(+), 138 deletions(-) diff --git a/airtime_mvc/application/configs/airtime-conf.php b/airtime_mvc/application/configs/airtime-conf.php index 74936f1ca..5ec20343b 100644 --- a/airtime_mvc/application/configs/airtime-conf.php +++ b/airtime_mvc/application/configs/airtime-conf.php @@ -1,6 +1,6 @@ array ( diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php index 0f0707722..602d55998 100644 --- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php @@ -101,6 +101,7 @@ class CcFilesTableMap extends TableMap { $this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null); $this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null); $this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'VARCHAR', false, 16, null); + $this->addForeignKey('OWNER_ID', 'ownerId', 'INTEGER', 'cc_subjs', 'ID', true, null, null); // validators } // initialize() @@ -109,7 +110,8 @@ class CcFilesTableMap extends TableMap { */ public function buildRelations() { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); + $this->addRelation('CcSubjsRelatedByownerId', '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('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null); $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); diff --git a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php index 6b1c9257e..e30b7a8b5 100644 --- a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php @@ -59,7 +59,8 @@ class CcSubjsTableMap extends TableMap { */ public function buildRelations() { - $this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null); + $this->addRelation('CcFilesRelatedByownerId', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'owner_id', ), null, null); + $this->addRelation('CcFilesRelatedByDbEditedby', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null); $this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null); $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null); $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), null, null); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php index 3b8daf54f..20c29d911 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php @@ -410,10 +410,21 @@ abstract class BaseCcFiles extends BaseObject implements Persistent */ protected $replay_gain; + /** + * The value for the owner_id field. + * @var int + */ + protected $owner_id; + /** * @var CcSubjs */ - protected $aCcSubjs; + protected $aCcSubjsRelatedByownerId; + + /** + * @var CcSubjs + */ + protected $aCcSubjsRelatedByDbEditedby; /** * @var CcMusicDirs @@ -1204,6 +1215,16 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this->replay_gain; } + /** + * Get the [owner_id] column value. + * + * @return int + */ + public function getownerId() + { + return $this->owner_id; + } + /** * Set the value of [id] column. * @@ -1385,8 +1406,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->modifiedColumns[] = CcFilesPeer::EDITEDBY; } - if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { - $this->aCcSubjs = null; + if ($this->aCcSubjsRelatedByDbEditedby !== null && $this->aCcSubjsRelatedByDbEditedby->getDbId() !== $v) { + $this->aCcSubjsRelatedByDbEditedby = null; } return $this; @@ -2588,6 +2609,30 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this; } // setDbReplayGain() + /** + * Set the value of [owner_id] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setownerId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->owner_id !== $v) { + $this->owner_id = $v; + $this->modifiedColumns[] = CcFilesPeer::OWNER_ID; + } + + if ($this->aCcSubjsRelatedByownerId !== null && $this->aCcSubjsRelatedByownerId->getDbId() !== $v) { + $this->aCcSubjsRelatedByownerId = null; + } + + return $this; + } // setownerId() + /** * Indicates whether the columns in this object are only set to default values. * @@ -2715,6 +2760,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->soundcloud_link_to_file = ($row[$startcol + 60] !== null) ? (string) $row[$startcol + 60] : null; $this->soundcloud_upload_time = ($row[$startcol + 61] !== null) ? (string) $row[$startcol + 61] : null; $this->replay_gain = ($row[$startcol + 62] !== null) ? (string) $row[$startcol + 62] : null; + $this->owner_id = ($row[$startcol + 63] !== null) ? (int) $row[$startcol + 63] : null; $this->resetModified(); $this->setNew(false); @@ -2723,7 +2769,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 63; // 63 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 64; // 64 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcFiles object", $e); @@ -2749,8 +2795,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->aCcMusicDirs !== null && $this->directory !== $this->aCcMusicDirs->getId()) { $this->aCcMusicDirs = null; } - if ($this->aCcSubjs !== null && $this->editedby !== $this->aCcSubjs->getDbId()) { - $this->aCcSubjs = null; + if ($this->aCcSubjsRelatedByDbEditedby !== null && $this->editedby !== $this->aCcSubjsRelatedByDbEditedby->getDbId()) { + $this->aCcSubjsRelatedByDbEditedby = null; + } + if ($this->aCcSubjsRelatedByownerId !== null && $this->owner_id !== $this->aCcSubjsRelatedByownerId->getDbId()) { + $this->aCcSubjsRelatedByownerId = null; } } // ensureConsistency @@ -2791,7 +2840,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? - $this->aCcSubjs = null; + $this->aCcSubjsRelatedByownerId = null; + $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; $this->collCcShowInstancess = null; @@ -2916,11 +2966,18 @@ abstract class BaseCcFiles extends BaseObject implements Persistent // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); + if ($this->aCcSubjsRelatedByownerId !== null) { + if ($this->aCcSubjsRelatedByownerId->isModified() || $this->aCcSubjsRelatedByownerId->isNew()) { + $affectedRows += $this->aCcSubjsRelatedByownerId->save($con); } - $this->setCcSubjs($this->aCcSubjs); + $this->setCcSubjsRelatedByownerId($this->aCcSubjsRelatedByownerId); + } + + if ($this->aCcSubjsRelatedByDbEditedby !== null) { + if ($this->aCcSubjsRelatedByDbEditedby->isModified() || $this->aCcSubjsRelatedByDbEditedby->isNew()) { + $affectedRows += $this->aCcSubjsRelatedByDbEditedby->save($con); + } + $this->setCcSubjsRelatedByDbEditedby($this->aCcSubjsRelatedByDbEditedby); } if ($this->aCcMusicDirs !== null) { @@ -3056,9 +3113,15 @@ abstract class BaseCcFiles extends BaseObject implements Persistent // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + if ($this->aCcSubjsRelatedByownerId !== null) { + if (!$this->aCcSubjsRelatedByownerId->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjsRelatedByownerId->getValidationFailures()); + } + } + + if ($this->aCcSubjsRelatedByDbEditedby !== null) { + if (!$this->aCcSubjsRelatedByDbEditedby->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjsRelatedByDbEditedby->getValidationFailures()); } } @@ -3328,6 +3391,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case 62: return $this->getDbReplayGain(); break; + case 63: + return $this->getownerId(); + break; default: return null; break; @@ -3415,10 +3481,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $keys[60] => $this->getDbSoundcloudLinkToFile(), $keys[61] => $this->getDbSoundCloundUploadTime(), $keys[62] => $this->getDbReplayGain(), + $keys[63] => $this->getownerId(), ); if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + if (null !== $this->aCcSubjsRelatedByownerId) { + $result['CcSubjsRelatedByownerId'] = $this->aCcSubjsRelatedByownerId->toArray($keyType, $includeLazyLoadColumns, true); + } + if (null !== $this->aCcSubjsRelatedByDbEditedby) { + $result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->toArray($keyType, $includeLazyLoadColumns, true); } if (null !== $this->aCcMusicDirs) { $result['CcMusicDirs'] = $this->aCcMusicDirs->toArray($keyType, $includeLazyLoadColumns, true); @@ -3643,6 +3713,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case 62: $this->setDbReplayGain($value); break; + case 63: + $this->setownerId($value); + break; } // switch() } @@ -3730,6 +3803,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if (array_key_exists($keys[60], $arr)) $this->setDbSoundcloudLinkToFile($arr[$keys[60]]); if (array_key_exists($keys[61], $arr)) $this->setDbSoundCloundUploadTime($arr[$keys[61]]); if (array_key_exists($keys[62], $arr)) $this->setDbReplayGain($arr[$keys[62]]); + if (array_key_exists($keys[63], $arr)) $this->setownerId($arr[$keys[63]]); } /** @@ -3804,6 +3878,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE)) $criteria->add(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, $this->soundcloud_link_to_file); if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME)) $criteria->add(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $this->soundcloud_upload_time); if ($this->isColumnModified(CcFilesPeer::REPLAY_GAIN)) $criteria->add(CcFilesPeer::REPLAY_GAIN, $this->replay_gain); + if ($this->isColumnModified(CcFilesPeer::OWNER_ID)) $criteria->add(CcFilesPeer::OWNER_ID, $this->owner_id); return $criteria; } @@ -3927,6 +4002,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $copyObj->setDbSoundcloudLinkToFile($this->soundcloud_link_to_file); $copyObj->setDbSoundCloundUploadTime($this->soundcloud_upload_time); $copyObj->setDbReplayGain($this->replay_gain); + $copyObj->setownerId($this->owner_id); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -4009,20 +4085,20 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * @return CcFiles The current object (for fluent API support) * @throws PropelException */ - public function setCcSubjs(CcSubjs $v = null) + public function setCcSubjsRelatedByownerId(CcSubjs $v = null) { if ($v === null) { - $this->setDbEditedby(NULL); + $this->setownerId(NULL); } else { - $this->setDbEditedby($v->getDbId()); + $this->setownerId($v->getDbId()); } - $this->aCcSubjs = $v; + $this->aCcSubjsRelatedByownerId = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the CcSubjs object, it will not be re-added. if ($v !== null) { - $v->addCcFiles($this); + $v->addCcFilesRelatedByownerId($this); } return $this; @@ -4036,19 +4112,68 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * @return CcSubjs The associated CcSubjs object. * @throws PropelException */ - public function getCcSubjs(PropelPDO $con = null) + public function getCcSubjsRelatedByownerId(PropelPDO $con = null) { - if ($this->aCcSubjs === null && ($this->editedby !== null)) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->editedby, $con); + if ($this->aCcSubjsRelatedByownerId === null && ($this->owner_id !== null)) { + $this->aCcSubjsRelatedByownerId = CcSubjsQuery::create()->findPk($this->owner_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. - $this->aCcSubjs->addCcFiless($this); + $this->aCcSubjsRelatedByownerId->addCcFilessRelatedByownerId($this); */ } - return $this->aCcSubjs; + return $this->aCcSubjsRelatedByownerId; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcFiles The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjsRelatedByDbEditedby(CcSubjs $v = null) + { + if ($v === null) { + $this->setDbEditedby(NULL); + } else { + $this->setDbEditedby($v->getDbId()); + } + + $this->aCcSubjsRelatedByDbEditedby = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcFilesRelatedByDbEditedby($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjsRelatedByDbEditedby(PropelPDO $con = null) + { + if ($this->aCcSubjsRelatedByDbEditedby === null && ($this->editedby !== null)) { + $this->aCcSubjsRelatedByDbEditedby = CcSubjsQuery::create()->findPk($this->editedby, $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->aCcSubjsRelatedByDbEditedby->addCcFilessRelatedByDbEditedby($this); + */ + } + return $this->aCcSubjsRelatedByDbEditedby; } /** @@ -4779,6 +4904,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->soundcloud_link_to_file = null; $this->soundcloud_upload_time = null; $this->replay_gain = null; + $this->owner_id = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->clearAllReferences(); @@ -4826,7 +4952,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collCcPlaylistcontentss = null; $this->collCcBlockcontentss = null; $this->collCcSchedules = null; - $this->aCcSubjs = null; + $this->aCcSubjsRelatedByownerId = null; + $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php index cc151400a..7d5a57a79 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcFilesPeer { const TM_CLASS = 'CcFilesTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 63; + const NUM_COLUMNS = 64; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -220,6 +220,9 @@ abstract class BaseCcFilesPeer { /** the column name for the REPLAY_GAIN field */ const REPLAY_GAIN = 'cc_files.REPLAY_GAIN'; + /** the column name for the OWNER_ID field */ + const OWNER_ID = 'cc_files.OWNER_ID'; + /** * An identiy map to hold any loaded instances of CcFiles objects. * This must be public so that other peer classes can access this when hydrating from JOIN @@ -236,12 +239,12 @@ abstract class BaseCcFilesPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', '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', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', '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', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::UTIME, self::LPTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, self::FILE_EXISTS, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, self::SOUNDCLOUD_UPLOAD_TIME, self::REPLAY_GAIN, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', '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', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', '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', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', ), - 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, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', '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', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'ownerId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', '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', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'ownerId', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::UTIME, self::LPTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, self::FILE_EXISTS, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, self::SOUNDCLOUD_UPLOAD_TIME, self::REPLAY_GAIN, self::OWNER_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', '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', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', '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', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_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, ) ); /** @@ -251,12 +254,12 @@ abstract class BaseCcFilesPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbState' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbState' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MIME => 2, self::FTYPE => 3, self::DIRECTORY => 4, self::FILEPATH => 5, self::STATE => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::UTIME => 10, self::LPTIME => 11, self::MD5 => 12, self::TRACK_TITLE => 13, self::ARTIST_NAME => 14, self::BIT_RATE => 15, self::SAMPLE_RATE => 16, self::FORMAT => 17, self::LENGTH => 18, self::ALBUM_TITLE => 19, self::GENRE => 20, self::COMMENTS => 21, self::YEAR => 22, self::TRACK_NUMBER => 23, self::CHANNELS => 24, self::URL => 25, self::BPM => 26, self::RATING => 27, self::ENCODED_BY => 28, self::DISC_NUMBER => 29, self::MOOD => 30, self::LABEL => 31, self::COMPOSER => 32, self::ENCODER => 33, self::CHECKSUM => 34, self::LYRICS => 35, self::ORCHESTRA => 36, self::CONDUCTOR => 37, self::LYRICIST => 38, self::ORIGINAL_LYRICIST => 39, self::RADIO_STATION_NAME => 40, self::INFO_URL => 41, self::ARTIST_URL => 42, self::AUDIO_SOURCE_URL => 43, self::RADIO_STATION_URL => 44, self::BUY_THIS_URL => 45, self::ISRC_NUMBER => 46, self::CATALOG_NUMBER => 47, self::ORIGINAL_ARTIST => 48, self::COPYRIGHT => 49, self::REPORT_DATETIME => 50, self::REPORT_LOCATION => 51, self::REPORT_ORGANIZATION => 52, self::SUBJECT => 53, self::CONTRIBUTOR => 54, self::LANGUAGE => 55, self::FILE_EXISTS => 56, self::SOUNDCLOUD_ID => 57, self::SOUNDCLOUD_ERROR_CODE => 58, self::SOUNDCLOUD_ERROR_MSG => 59, self::SOUNDCLOUD_LINK_TO_FILE => 60, self::SOUNDCLOUD_UPLOAD_TIME => 61, self::REPLAY_GAIN => 62, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'STATE' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, ), - 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, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbState' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'ownerId' => 63, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbState' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'ownerId' => 63, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MIME => 2, self::FTYPE => 3, self::DIRECTORY => 4, self::FILEPATH => 5, self::STATE => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::UTIME => 10, self::LPTIME => 11, self::MD5 => 12, self::TRACK_TITLE => 13, self::ARTIST_NAME => 14, self::BIT_RATE => 15, self::SAMPLE_RATE => 16, self::FORMAT => 17, self::LENGTH => 18, self::ALBUM_TITLE => 19, self::GENRE => 20, self::COMMENTS => 21, self::YEAR => 22, self::TRACK_NUMBER => 23, self::CHANNELS => 24, self::URL => 25, self::BPM => 26, self::RATING => 27, self::ENCODED_BY => 28, self::DISC_NUMBER => 29, self::MOOD => 30, self::LABEL => 31, self::COMPOSER => 32, self::ENCODER => 33, self::CHECKSUM => 34, self::LYRICS => 35, self::ORCHESTRA => 36, self::CONDUCTOR => 37, self::LYRICIST => 38, self::ORIGINAL_LYRICIST => 39, self::RADIO_STATION_NAME => 40, self::INFO_URL => 41, self::ARTIST_URL => 42, self::AUDIO_SOURCE_URL => 43, self::RADIO_STATION_URL => 44, self::BUY_THIS_URL => 45, self::ISRC_NUMBER => 46, self::CATALOG_NUMBER => 47, self::ORIGINAL_ARTIST => 48, self::COPYRIGHT => 49, self::REPORT_DATETIME => 50, self::REPORT_LOCATION => 51, self::REPORT_ORGANIZATION => 52, self::SUBJECT => 53, self::CONTRIBUTOR => 54, self::LANGUAGE => 55, self::FILE_EXISTS => 56, self::SOUNDCLOUD_ID => 57, self::SOUNDCLOUD_ERROR_CODE => 58, self::SOUNDCLOUD_ERROR_MSG => 59, self::SOUNDCLOUD_LINK_TO_FILE => 60, self::SOUNDCLOUD_UPLOAD_TIME => 61, self::REPLAY_GAIN => 62, self::OWNER_ID => 63, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'STATE' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, ), + 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, ) ); /** @@ -391,6 +394,7 @@ abstract class BaseCcFilesPeer { $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE); $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME); $criteria->addSelectColumn(CcFilesPeer::REPLAY_GAIN); + $criteria->addSelectColumn(CcFilesPeer::OWNER_ID); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.NAME'); @@ -455,6 +459,7 @@ abstract class BaseCcFilesPeer { $criteria->addSelectColumn($alias . '.SOUNDCLOUD_LINK_TO_FILE'); $criteria->addSelectColumn($alias . '.SOUNDCLOUD_UPLOAD_TIME'); $criteria->addSelectColumn($alias . '.REPLAY_GAIN'); + $criteria->addSelectColumn($alias . '.OWNER_ID'); } } @@ -753,7 +758,7 @@ abstract class BaseCcFilesPeer { } /** - * Returns the number of rows matching criteria, joining the related CcSubjs table + * Returns the number of rows matching criteria, joining the related CcSubjsRelatedByownerId table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -761,7 +766,57 @@ abstract class BaseCcFilesPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinCcSubjsRelatedByownerId(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(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcSubjsRelatedByDbEditedby 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 doCountJoinCcSubjsRelatedByDbEditedby(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; @@ -861,7 +916,73 @@ abstract class BaseCcFilesPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinCcSubjsRelatedByownerId(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(self::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcFilesPeer::OWNER_ID, 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(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcFiles) to $obj2 (CcSubjs) + $obj2->addCcFilesRelatedByownerId($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcFiles objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjsRelatedByDbEditedby(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; @@ -907,7 +1028,7 @@ abstract class BaseCcFilesPeer { } // if obj2 already loaded // Add the $obj1 (CcFiles) to $obj2 (CcSubjs) - $obj2->addCcFiles($obj1); + $obj2->addCcFilesRelatedByDbEditedby($obj1); } // if joined row was not null @@ -1020,6 +1141,8 @@ abstract class BaseCcFilesPeer { $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); $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior); @@ -1060,8 +1183,13 @@ abstract class BaseCcFilesPeer { CcSubjsPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + CcMusicDirsPeer::addSelectColumns($criteria); - $startcol4 = $startcol3 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS); + $startcol5 = $startcol4 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior); $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); @@ -1099,25 +1227,43 @@ abstract class BaseCcFilesPeer { } // if obj2 loaded // Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs) - $obj2->addCcFiles($obj1); + $obj2->addCcFilesRelatedByownerId($obj1); + } // if joined row not null + + // Add objects for joined CcSubjs rows + + $key3 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = CcSubjsPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + CcSubjsPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (CcFiles) to the collection in $obj3 (CcSubjs) + $obj3->addCcFilesRelatedByDbEditedby($obj1); } // if joined row not null // Add objects for joined CcMusicDirs rows - $key3 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol3); - if ($key3 !== null) { - $obj3 = CcMusicDirsPeer::getInstanceFromPool($key3); - if (!$obj3) { + $key4 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol4); + if ($key4 !== null) { + $obj4 = CcMusicDirsPeer::getInstanceFromPool($key4); + if (!$obj4) { $cls = CcMusicDirsPeer::getOMClass(false); - $obj3 = new $cls(); - $obj3->hydrate($row, $startcol3); - CcMusicDirsPeer::addInstanceToPool($obj3, $key3); - } // if obj3 loaded + $obj4 = new $cls(); + $obj4->hydrate($row, $startcol4); + CcMusicDirsPeer::addInstanceToPool($obj4, $key4); + } // if obj4 loaded - // Add the $obj1 (CcFiles) to the collection in $obj3 (CcMusicDirs) - $obj3->addCcFiles($obj1); + // Add the $obj1 (CcFiles) to the collection in $obj4 (CcMusicDirs) + $obj4->addCcFiles($obj1); } // if joined row not null $results[] = $obj1; @@ -1128,7 +1274,7 @@ abstract class BaseCcFilesPeer { /** - * Returns the number of rows matching criteria, joining the related CcSubjs table + * Returns the number of rows matching criteria, joining the related CcSubjsRelatedByownerId table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -1136,7 +1282,57 @@ abstract class BaseCcFilesPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinAllExceptCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinAllExceptCcSubjsRelatedByownerId(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(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::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 CcSubjsRelatedByDbEditedby 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 doCountJoinAllExceptCcSubjsRelatedByDbEditedby(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; @@ -1213,6 +1409,8 @@ abstract class BaseCcFilesPeer { $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); @@ -1228,7 +1426,7 @@ abstract class BaseCcFilesPeer { /** - * Selects a collection of CcFiles objects pre-filled with all related objects except CcSubjs. + * Selects a collection of CcFiles objects pre-filled with all related objects except CcSubjsRelatedByownerId. * * @param Criteria $criteria * @param PropelPDO $con @@ -1237,7 +1435,80 @@ abstract class BaseCcFilesPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinAllExceptCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinAllExceptCcSubjsRelatedByownerId(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(self::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol2 = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcMusicDirsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::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(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcMusicDirs rows + + $key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcMusicDirsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcMusicDirsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcMusicDirsPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcFiles) to the collection in $obj2 (CcMusicDirs) + $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 CcSubjsRelatedByDbEditedby. + * + * @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 doSelectJoinAllExceptCcSubjsRelatedByDbEditedby(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; @@ -1327,6 +1598,11 @@ abstract class BaseCcFilesPeer { CcSubjsPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior); + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); @@ -1362,7 +1638,26 @@ abstract class BaseCcFilesPeer { } // if $obj2 already loaded // Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs) - $obj2->addCcFiles($obj1); + $obj2->addCcFilesRelatedByownerId($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(false); + + $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 diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php index 1dce43d8d..122e35707 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -69,6 +69,7 @@ * @method CcFilesQuery orderByDbSoundcloudLinkToFile($order = Criteria::ASC) Order by the soundcloud_link_to_file column * @method CcFilesQuery orderByDbSoundCloundUploadTime($order = Criteria::ASC) Order by the soundcloud_upload_time column * @method CcFilesQuery orderByDbReplayGain($order = Criteria::ASC) Order by the replay_gain column + * @method CcFilesQuery orderByownerId($order = Criteria::ASC) Order by the owner_id column * * @method CcFilesQuery groupByDbId() Group by the id column * @method CcFilesQuery groupByDbName() Group by the name column @@ -133,14 +134,19 @@ * @method CcFilesQuery groupByDbSoundcloudLinkToFile() Group by the soundcloud_link_to_file column * @method CcFilesQuery groupByDbSoundCloundUploadTime() Group by the soundcloud_upload_time column * @method CcFilesQuery groupByDbReplayGain() Group by the replay_gain column + * @method CcFilesQuery groupByownerId() Group by the owner_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 * @method CcFilesQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method CcFilesQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation - * @method CcFilesQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation - * @method CcFilesQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation + * @method CcFilesQuery leftJoinCcSubjsRelatedByownerId($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByownerId relation + * @method CcFilesQuery rightJoinCcSubjsRelatedByownerId($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByownerId relation + * @method CcFilesQuery innerJoinCcSubjsRelatedByownerId($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjsRelatedByownerId relation + * + * @method CcFilesQuery leftJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation + * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation + * @method CcFilesQuery innerJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * * @method CcFilesQuery leftJoinCcMusicDirs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcMusicDirs relation * @method CcFilesQuery rightJoinCcMusicDirs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcMusicDirs relation @@ -228,6 +234,7 @@ * @method CcFiles findOneByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return the first CcFiles filtered by the soundcloud_link_to_file column * @method CcFiles findOneByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return the first CcFiles filtered by the soundcloud_upload_time column * @method CcFiles findOneByDbReplayGain(string $replay_gain) Return the first CcFiles filtered by the replay_gain column + * @method CcFiles findOneByownerId(int $owner_id) Return the first CcFiles filtered by the owner_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 @@ -292,6 +299,7 @@ * @method array findByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return CcFiles objects filtered by the soundcloud_link_to_file column * @method array findByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return CcFiles objects filtered by the soundcloud_upload_time column * @method array findByDbReplayGain(string $replay_gain) Return CcFiles objects filtered by the replay_gain column + * @method array findByownerId(int $owner_id) Return CcFiles objects filtered by the owner_id column * * @package propel.generator.airtime.om */ @@ -1903,6 +1911,37 @@ abstract class BaseCcFilesQuery extends ModelCriteria return $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain, $comparison); } + /** + * Filter the query on the owner_id column + * + * @param int|array $ownerId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByownerId($ownerId = null, $comparison = null) + { + if (is_array($ownerId)) { + $useMinMax = false; + if (isset($ownerId['min'])) { + $this->addUsingAlias(CcFilesPeer::OWNER_ID, $ownerId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($ownerId['max'])) { + $this->addUsingAlias(CcFilesPeer::OWNER_ID, $ownerId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::OWNER_ID, $ownerId, $comparison); + } + /** * Filter the query by a related CcSubjs object * @@ -1911,24 +1950,24 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcFilesQuery The current query, for fluid interface */ - public function filterByCcSubjs($ccSubjs, $comparison = null) + public function filterByCcSubjsRelatedByownerId($ccSubjs, $comparison = null) { return $this - ->addUsingAlias(CcFilesPeer::EDITEDBY, $ccSubjs->getDbId(), $comparison); + ->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->getDbId(), $comparison); } /** - * Adds a JOIN clause to the query using the CcSubjs relation + * Adds a JOIN clause to the query using the CcSubjsRelatedByownerId 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 joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function joinCcSubjsRelatedByownerId($relationAlias = '', $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); + $relationMap = $tableMap->getRelation('CcSubjsRelatedByownerId'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -1943,14 +1982,14 @@ abstract class BaseCcFilesQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'CcSubjs'); + $this->addJoinObject($join, 'CcSubjsRelatedByownerId'); } return $this; } /** - * Use the CcSubjs relation CcSubjs object + * Use the CcSubjsRelatedByownerId relation CcSubjs object * * @see useQuery() * @@ -1960,11 +1999,75 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcSubjsQuery A secondary query class using the current class as primary query */ - public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function useCcSubjsRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) { return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + ->joinCcSubjsRelatedByownerId($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByownerId', 'CcSubjsQuery'); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object 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 + */ + public function filterByCcSubjsRelatedByDbEditedby($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcFilesPeer::EDITEDBY, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjsRelatedByDbEditedby 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 joinCcSubjsRelatedByDbEditedby($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjsRelatedByDbEditedby'); + + // 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, 'CcSubjsRelatedByDbEditedby'); + } + + return $this; + } + + /** + * Use the CcSubjsRelatedByDbEditedby relation CcSubjs object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsRelatedByDbEditedbyQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSubjsRelatedByDbEditedby($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByDbEditedby', 'CcSubjsQuery'); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php index 4752a822e..87984ef97 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php @@ -999,10 +999,35 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array CcFiles[] List of CcFiles objects */ - public function getCcFilessJoinCcSubjs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public function getCcFilessJoinCcSubjsRelatedByownerId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = CcFilesQuery::create(null, $criteria); - $query->joinWith('CcSubjs', $join_behavior); + $query->joinWith('CcSubjsRelatedByownerId', $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 CcMusicDirs is new, it will return + * an empty collection; or if this CcMusicDirs 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 CcMusicDirs. + * + * @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 PropelCollection|array 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); } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php index 3b25ce02f..6e42a4c9c 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php @@ -111,7 +111,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent /** * @var array CcFiles[] Collection to store aggregation of CcFiles objects. */ - protected $collCcFiless; + protected $collCcFilessRelatedByownerId; + + /** + * @var array CcFiles[] Collection to store aggregation of CcFiles objects. + */ + protected $collCcFilessRelatedByDbEditedby; /** * @var array CcPerms[] Collection to store aggregation of CcPerms objects. @@ -821,7 +826,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? - $this->collCcFiless = null; + $this->collCcFilessRelatedByownerId = null; + + $this->collCcFilessRelatedByDbEditedby = null; $this->collCcPermss = null; @@ -970,8 +977,16 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } - if ($this->collCcFiless !== null) { - foreach ($this->collCcFiless as $referrerFK) { + if ($this->collCcFilessRelatedByownerId !== null) { + foreach ($this->collCcFilessRelatedByownerId as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcFilessRelatedByDbEditedby !== null) { + foreach ($this->collCcFilessRelatedByDbEditedby as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } @@ -1105,8 +1120,16 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } - if ($this->collCcFiless !== null) { - foreach ($this->collCcFiless as $referrerFK) { + if ($this->collCcFilessRelatedByownerId !== null) { + foreach ($this->collCcFilessRelatedByownerId as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcFilessRelatedByDbEditedby !== null) { + foreach ($this->collCcFilessRelatedByDbEditedby as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } @@ -1487,9 +1510,15 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getCcFiless() as $relObj) { + foreach ($this->getCcFilessRelatedByownerId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcFiles($relObj->copy($deepCopy)); + $copyObj->addCcFilesRelatedByownerId($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcFilessRelatedByDbEditedby() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcFilesRelatedByDbEditedby($relObj->copy($deepCopy)); } } @@ -1581,32 +1610,32 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } /** - * Clears out the collCcFiless collection + * Clears out the collCcFilessRelatedByownerId 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 void - * @see addCcFiless() + * @see addCcFilessRelatedByownerId() */ - public function clearCcFiless() + public function clearCcFilessRelatedByownerId() { - $this->collCcFiless = null; // important to set this to NULL since that means it is uninitialized + $this->collCcFilessRelatedByownerId = null; // important to set this to NULL since that means it is uninitialized } /** - * Initializes the collCcFiless collection. + * Initializes the collCcFilessRelatedByownerId collection. * - * By default this just sets the collCcFiless collection to an empty array (like clearcollCcFiless()); + * By default this just sets the collCcFilessRelatedByownerId collection to an empty array (like clearcollCcFilessRelatedByownerId()); * 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. * * @return void */ - public function initCcFiless() + public function initCcFilessRelatedByownerId() { - $this->collCcFiless = new PropelObjectCollection(); - $this->collCcFiless->setModel('CcFiles'); + $this->collCcFilessRelatedByownerId = new PropelObjectCollection(); + $this->collCcFilessRelatedByownerId->setModel('CcFiles'); } /** @@ -1623,23 +1652,23 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @return PropelCollection|array CcFiles[] List of CcFiles objects * @throws PropelException */ - public function getCcFiless($criteria = null, PropelPDO $con = null) + public function getCcFilessRelatedByownerId($criteria = null, PropelPDO $con = null) { - if(null === $this->collCcFiless || null !== $criteria) { - if ($this->isNew() && null === $this->collCcFiless) { + if(null === $this->collCcFilessRelatedByownerId || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFilessRelatedByownerId) { // return empty collection - $this->initCcFiless(); + $this->initCcFilessRelatedByownerId(); } else { - $collCcFiless = CcFilesQuery::create(null, $criteria) - ->filterByCcSubjs($this) + $collCcFilessRelatedByownerId = CcFilesQuery::create(null, $criteria) + ->filterByCcSubjsRelatedByownerId($this) ->find($con); if (null !== $criteria) { - return $collCcFiless; + return $collCcFilessRelatedByownerId; } - $this->collCcFiless = $collCcFiless; + $this->collCcFilessRelatedByownerId = $collCcFilessRelatedByownerId; } } - return $this->collCcFiless; + return $this->collCcFilessRelatedByownerId; } /** @@ -1651,10 +1680,10 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @return int Count of related CcFiles objects. * @throws PropelException */ - public function countCcFiless(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + public function countCcFilessRelatedByownerId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { - if(null === $this->collCcFiless || null !== $criteria) { - if ($this->isNew() && null === $this->collCcFiless) { + if(null === $this->collCcFilessRelatedByownerId || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFilessRelatedByownerId) { return 0; } else { $query = CcFilesQuery::create(null, $criteria); @@ -1662,11 +1691,11 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $query->distinct(); } return $query - ->filterByCcSubjs($this) + ->filterByCcSubjsRelatedByownerId($this) ->count($con); } } else { - return count($this->collCcFiless); + return count($this->collCcFilessRelatedByownerId); } } @@ -1678,14 +1707,14 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @return void * @throws PropelException */ - public function addCcFiles(CcFiles $l) + public function addCcFilesRelatedByownerId(CcFiles $l) { - if ($this->collCcFiless === null) { - $this->initCcFiless(); + if ($this->collCcFilessRelatedByownerId === null) { + $this->initCcFilessRelatedByownerId(); } - if (!$this->collCcFiless->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcFiless[]= $l; - $l->setCcSubjs($this); + if (!$this->collCcFilessRelatedByownerId->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcFilessRelatedByownerId[]= $l; + $l->setCcSubjsRelatedByownerId($this); } } @@ -1695,7 +1724,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * 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 CcFiless from storage. + * been saved, it will retrieve related CcFilessRelatedByownerId from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you @@ -1706,12 +1735,146 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array CcFiles[] List of CcFiles objects */ - public function getCcFilessJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public function getCcFilessRelatedByownerIdJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = CcFilesQuery::create(null, $criteria); $query->joinWith('CcMusicDirs', $join_behavior); - return $this->getCcFiless($query, $con); + return $this->getCcFilessRelatedByownerId($query, $con); + } + + /** + * Clears out the collCcFilessRelatedByDbEditedby 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 void + * @see addCcFilessRelatedByDbEditedby() + */ + public function clearCcFilessRelatedByDbEditedby() + { + $this->collCcFilessRelatedByDbEditedby = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcFilessRelatedByDbEditedby collection. + * + * By default this just sets the collCcFilessRelatedByDbEditedby collection to an empty array (like clearcollCcFilessRelatedByDbEditedby()); + * 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. + * + * @return void + */ + public function initCcFilessRelatedByDbEditedby() + { + $this->collCcFilessRelatedByDbEditedby = new PropelObjectCollection(); + $this->collCcFilessRelatedByDbEditedby->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 CcSubjs is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcFiles[] List of CcFiles objects + * @throws PropelException + */ + public function getCcFilessRelatedByDbEditedby($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcFilessRelatedByDbEditedby || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFilessRelatedByDbEditedby) { + // return empty collection + $this->initCcFilessRelatedByDbEditedby(); + } else { + $collCcFilessRelatedByDbEditedby = CcFilesQuery::create(null, $criteria) + ->filterByCcSubjsRelatedByDbEditedby($this) + ->find($con); + if (null !== $criteria) { + return $collCcFilessRelatedByDbEditedby; + } + $this->collCcFilessRelatedByDbEditedby = $collCcFilessRelatedByDbEditedby; + } + } + return $this->collCcFilessRelatedByDbEditedby; + } + + /** + * 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 countCcFilessRelatedByDbEditedby(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcFilessRelatedByDbEditedby || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFilessRelatedByDbEditedby) { + return 0; + } else { + $query = CcFilesQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjsRelatedByDbEditedby($this) + ->count($con); + } + } else { + return count($this->collCcFilessRelatedByDbEditedby); + } + } + + /** + * Method called to associate a CcFiles object to this object + * through the CcFiles foreign key attribute. + * + * @param CcFiles $l CcFiles + * @return void + * @throws PropelException + */ + public function addCcFilesRelatedByDbEditedby(CcFiles $l) + { + if ($this->collCcFilessRelatedByDbEditedby === null) { + $this->initCcFilessRelatedByDbEditedby(); + } + if (!$this->collCcFilessRelatedByDbEditedby->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcFilessRelatedByDbEditedby[]= $l; + $l->setCcSubjsRelatedByDbEditedby($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 PropelCollection|array CcFiles[] List of CcFiles objects + */ + public function getCcFilessRelatedByDbEditedbyJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcFilesQuery::create(null, $criteria); + $query->joinWith('CcMusicDirs', $join_behavior); + + return $this->getCcFilessRelatedByDbEditedby($query, $con); } /** @@ -2541,8 +2704,13 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collCcFiless) { - foreach ((array) $this->collCcFiless as $o) { + if ($this->collCcFilessRelatedByownerId) { + foreach ((array) $this->collCcFilessRelatedByownerId as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcFilessRelatedByDbEditedby) { + foreach ((array) $this->collCcFilessRelatedByDbEditedby as $o) { $o->clearAllReferences($deep); } } @@ -2583,7 +2751,8 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } // if ($deep) - $this->collCcFiless = null; + $this->collCcFilessRelatedByownerId = null; + $this->collCcFilessRelatedByDbEditedby = null; $this->collCcPermss = null; $this->collCcShowHostss = null; $this->collCcPlaylists = null; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php index 1bd561510..778c1eeee 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php @@ -38,9 +38,13 @@ * @method CcSubjsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcSubjsQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method CcSubjsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation - * @method CcSubjsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation - * @method CcSubjsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation + * @method CcSubjsQuery leftJoinCcFilesRelatedByownerId($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFilesRelatedByownerId relation + * @method CcSubjsQuery rightJoinCcFilesRelatedByownerId($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByownerId relation + * @method CcSubjsQuery innerJoinCcFilesRelatedByownerId($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFilesRelatedByownerId relation + * + * @method CcSubjsQuery leftJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation + * @method CcSubjsQuery rightJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation + * @method CcSubjsQuery innerJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFilesRelatedByDbEditedby relation * * @method CcSubjsQuery leftJoinCcPerms($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPerms relation * @method CcSubjsQuery rightJoinCcPerms($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPerms relation @@ -525,24 +529,24 @@ abstract class BaseCcSubjsQuery extends ModelCriteria * * @return CcSubjsQuery The current query, for fluid interface */ - public function filterByCcFiles($ccFiles, $comparison = null) + public function filterByCcFilesRelatedByownerId($ccFiles, $comparison = null) { return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbEditedby(), $comparison); + ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getownerId(), $comparison); } /** - * Adds a JOIN clause to the query using the CcFiles relation + * Adds a JOIN clause to the query using the CcFilesRelatedByownerId relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return CcSubjsQuery The current query, for fluid interface */ - public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function joinCcFilesRelatedByownerId($relationAlias = '', $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcFiles'); + $relationMap = $tableMap->getRelation('CcFilesRelatedByownerId'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -557,14 +561,14 @@ abstract class BaseCcSubjsQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'CcFiles'); + $this->addJoinObject($join, 'CcFilesRelatedByownerId'); } return $this; } /** - * Use the CcFiles relation CcFiles object + * Use the CcFilesRelatedByownerId relation CcFiles object * * @see useQuery() * @@ -574,11 +578,75 @@ abstract class BaseCcSubjsQuery extends ModelCriteria * * @return CcFilesQuery A secondary query class using the current class as primary query */ - public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function useCcFilesRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) { return $this - ->joinCcFiles($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + ->joinCcFilesRelatedByownerId($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByownerId', 'CcFilesQuery'); + } + + /** + * Filter the query by a related CcFiles object + * + * @param CcFiles $ccFiles the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcFilesRelatedByDbEditedby($ccFiles, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbEditedby(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcFilesRelatedByDbEditedby relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcFilesRelatedByDbEditedby($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcFilesRelatedByDbEditedby'); + + // 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, 'CcFilesRelatedByDbEditedby'); + } + + return $this; + } + + /** + * Use the CcFilesRelatedByDbEditedby 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 useCcFilesRelatedByDbEditedbyQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcFilesRelatedByDbEditedby($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByDbEditedby', 'CcFilesQuery'); } /** diff --git a/airtime_mvc/build/build.properties b/airtime_mvc/build/build.properties index 50699f0d9..817933bf1 100644 --- a/airtime_mvc/build/build.properties +++ b/airtime_mvc/build/build.properties @@ -1,6 +1,6 @@ #Note: project.home is automatically generated by the propel-install script. #Any manual changes to this value will be overwritten. -project.home = /home/james/src/airtime/airtime_mvc +project.home = /home/rudi/Airtime/airtime_mvc project.build = ${project.home}/build #Database driver diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 25cd4d716..92f56f25b 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -75,8 +75,8 @@ - - + + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index eaccf7596..3d55743ec 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -93,6 +93,7 @@ CREATE TABLE "cc_files" "soundcloud_link_to_file" VARCHAR(4096), "soundcloud_upload_time" TIMESTAMP(6), "replay_gain" VARCHAR(16), + "owner_id" INTEGER NOT NULL, PRIMARY KEY ("id") ); @@ -666,6 +667,8 @@ COMMENT ON TABLE "cc_webstream_metadata" IS ''; SET search_path TO public; +ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey" FOREIGN KEY ("owner_id") REFERENCES "cc_subjs" ("id"); + ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id"); ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey" FOREIGN KEY ("directory") REFERENCES "cc_music_dirs" ("id"); From 36b344a9107f07a987e34d4f5f7f7423b719d1d0 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 11:48:34 -0400 Subject: [PATCH 05/23] cc-3936: remove unneeded garbage. --- .../application/controllers/ApiController.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index b34cd2c9c..789179399 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -463,17 +463,10 @@ class ApiController extends Zend_Controller_Action $this->view->watched_dirs = $watchedDirsPath; } - public function dispatchMetadata($md, $mode, $dry_run=false) + public function dispatchMetadata($md, $mode) { // Replace this compound result in a hash with proper error handling later on $return_hash = array(); - if ( $dry_run ) { // for debugging we return garbage not to screw around with the db - return array( - 'md' => $md, - 'mode' => $mode, - 'fileid' => 123456 - ); - } Application_Model_Preference::SetImportTimestamp(); Logging::info("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} "); Logging::info( $md ); @@ -586,8 +579,7 @@ class ApiController extends Zend_Controller_Action // Removing 'mode' key from $info_json might not be necessary... $mode = $info_json['mode']; unset( $info_json['mode'] ); - $response = $this->dispatchMetadata($info_json, $mode, - $dry_run=$dry); + $response = $this->dispatchMetadata($info_json, $mode); // We tack on the 'key' back to every request in case the would like to associate // his requests with particular responses $response['key'] = $k; From e2d9f220f8d447be74bc00cb7f5434e2acad8adf Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 13:44:53 -0400 Subject: [PATCH 06/23] cc-3936: Changed schema so that owner_id is not required for every file. --- airtime_mvc/build/schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 92f56f25b..c9f7befe9 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -75,7 +75,7 @@ - + From 996dcfd35fd4a37acb7adbc9f3a5ceeeeccf6dbb Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 13:49:49 -0400 Subject: [PATCH 07/23] cc-3936: Ran propgen to generate schema changes --- airtime_mvc/application/models/StoredFile.php | 3 +++ .../application/models/airtime/map/CcFilesTableMap.php | 2 +- .../application/models/airtime/om/BaseCcFilesQuery.php | 4 ++-- .../application/models/airtime/om/BaseCcSubjsQuery.php | 4 ++-- airtime_mvc/build/sql/schema.sql | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 5eb13631e..859649332 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -466,6 +466,9 @@ class Application_Model_StoredFile $storedFile->_file = $file; // removed "//" in the path. Always use '/' for path separator + // TODO : it might be better to just call OsPath::normpath on the file + // path. Also note that mediamonitor normalizes the paths anyway + // before passing them to php so it's not necessary to do this at all $filepath = str_replace("//", "/", $md['MDATA_KEY_FILEPATH']); $res = $storedFile->setFilePath($filepath); if ($res === -1) { diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php index 602d55998..d7c258f19 100644 --- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php @@ -101,7 +101,7 @@ class CcFilesTableMap extends TableMap { $this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null); $this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null); $this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'VARCHAR', false, 16, null); - $this->addForeignKey('OWNER_ID', 'ownerId', 'INTEGER', 'cc_subjs', 'ID', true, null, null); + $this->addForeignKey('OWNER_ID', 'ownerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php index 122e35707..188cce5a1 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -1964,7 +1964,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcFilesQuery The current query, for fluid interface */ - public function joinCcSubjsRelatedByownerId($relationAlias = '', $joinType = Criteria::INNER_JOIN) + public function joinCcSubjsRelatedByownerId($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('CcSubjsRelatedByownerId'); @@ -1999,7 +1999,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcSubjsQuery A secondary query class using the current class as primary query */ - public function useCcSubjsRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + public function useCcSubjsRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { return $this ->joinCcSubjsRelatedByownerId($relationAlias, $joinType) diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php index 778c1eeee..7487f7952 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php @@ -543,7 +543,7 @@ abstract class BaseCcSubjsQuery extends ModelCriteria * * @return CcSubjsQuery The current query, for fluid interface */ - public function joinCcFilesRelatedByownerId($relationAlias = '', $joinType = Criteria::INNER_JOIN) + public function joinCcFilesRelatedByownerId($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('CcFilesRelatedByownerId'); @@ -578,7 +578,7 @@ abstract class BaseCcSubjsQuery extends ModelCriteria * * @return CcFilesQuery A secondary query class using the current class as primary query */ - public function useCcFilesRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + public function useCcFilesRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { return $this ->joinCcFilesRelatedByownerId($relationAlias, $joinType) diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index 3d55743ec..6a56b336e 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -93,7 +93,7 @@ CREATE TABLE "cc_files" "soundcloud_link_to_file" VARCHAR(4096), "soundcloud_upload_time" TIMESTAMP(6), "replay_gain" VARCHAR(16), - "owner_id" INTEGER NOT NULL, + "owner_id" INTEGER, PRIMARY KEY ("id") ); From 50de229258ec4c746d443fe6e9b693759729a192 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 14:41:54 -0400 Subject: [PATCH 08/23] cc-3936: Refactored getUsers not to take multiple types of arguments. --- airtime_mvc/application/models/User.php | 32 ++++++++++--------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 9788f7641..88a7ba1c6 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -238,21 +238,17 @@ class Application_Model_User return $user; } - public static function getUsers($type, $search=null) + public static function getUsers(array $type, $search=null) { $con = Propel::getConnection(); $sql_gen = "SELECT login AS value, login AS label, id as index FROM cc_subjs "; $sql = $sql_gen; - if (is_array($type)) { - for ($i=0; $iid); - } catch (Exception $e) { - //we get here if $userinfo->id is defined, but doesn't exist - //in the database anymore. - Zend_Auth::getInstance()->clearIdentity(); - - return null; - } + } + try { + return new self($userinfo->id); + } catch (Exception $e) { + //we get here if $userinfo->id is defined, but doesn't exist + //in the database anymore. + Zend_Auth::getInstance()->clearIdentity(); + return null; } } } From dcc9c58577b90c408ea845e45a44159f9dc3fd29 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 14:44:14 -0400 Subject: [PATCH 09/23] cc-3936: Sexified equal signs. --- airtime_mvc/application/controllers/UserController.php | 4 ++-- airtime_mvc/application/models/User.php | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php index 0c86e29eb..00040718e 100644 --- a/airtime_mvc/application/controllers/UserController.php +++ b/airtime_mvc/application/controllers/UserController.php @@ -70,8 +70,8 @@ class UserController extends Zend_Controller_Action public function getHostsAction() { - $search = $this->_getParam('term'); - $res = Application_Model_User::getHosts($search); + $search = $this->_getParam('term'); + $res = Application_Model_User::getHosts($search); $this->view->hosts = Application_Model_User::getHosts($search); } diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 88a7ba1c6..fc6e6a3cf 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -240,22 +240,23 @@ class Application_Model_User public static function getUsers(array $type, $search=null) { - $con = Propel::getConnection(); + $con = Propel::getConnection(); $sql_gen = "SELECT login AS value, login AS label, id as index FROM cc_subjs "; - $sql = $sql_gen; + $sql = $sql_gen; $type = array_map( function($t) { return "type = '{$type[$i]}'"; }, $type); + $sql_type = join(" OR ", $type); - $sql = $sql_gen ." WHERE (". $sql_type.") "; + $sql = $sql_gen ." WHERE (". $sql_type.") "; if (!is_null($search)) { $like = "login ILIKE '%{$search}%'"; - $sql = $sql . " AND ".$like; + $sql = $sql . " AND ".$like; } $sql = $sql ." ORDER BY login"; From 43ca0d21e621df8e557d33f7cec5c257af948d30 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 15:06:11 -0400 Subject: [PATCH 10/23] cc-3936: removed unnecessary object creation --- airtime_mvc/application/models/StoredFile.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 859649332..e3f7aafec 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -459,8 +459,10 @@ class Application_Model_StoredFile } $file = new CcFiles(); - $file->setDbUtime(new DateTime("now", new DateTimeZone("UTC"))); - $file->setDbMtime(new DateTime("now", new DateTimeZone("UTC"))); + $now = new DateTime("now", new DateTimeZone("UTC")); + + $file->setDbUtime($now); + $file->setDbMtime($now); $storedFile = new Application_Model_StoredFile(); $storedFile->_file = $file; From b0a61fc29186b41e59cd3495dc17947e0013a4ae Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 15:24:23 -0400 Subject: [PATCH 11/23] cc-3936: Added setting default owner_id for inserted files. --- airtime_mvc/application/models/StoredFile.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index e3f7aafec..c1f13d4e9 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -150,6 +150,7 @@ class Application_Model_StoredFile if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) { continue; } + // if owner is not present then we will if (isset($this->_dbMD[$dbColumn])) { $propelColumn = $this->_dbMD[$dbColumn]; $method = "set$propelColumn"; @@ -459,8 +460,7 @@ class Application_Model_StoredFile } $file = new CcFiles(); - $now = new DateTime("now", new DateTimeZone("UTC")); - + $now = new DateTime("now", new DateTimeZone("UTC")); $file->setDbUtime($now); $file->setDbMtime($now); @@ -472,6 +472,18 @@ class Application_Model_StoredFile // path. Also note that mediamonitor normalizes the paths anyway // before passing them to php so it's not necessary to do this at all $filepath = str_replace("//", "/", $md['MDATA_KEY_FILEPATH']); + // if MDATA_OWNER_ID is not set then we default to the first admin user + // we find + if (!array_key_exists($md, 'MDATA_OWNER_ID')) { + $admins = Application_Model_User::getUsers(array('A')); + if (count($admins) > 0) { // found admin => pick first one + $md['MDATA_OWNER_ID'] = $admins[0]->getId(); + } + else { + Logging::info("Could not find any admin users in the database + for inserted file. Defaulting to NULL"); + } + } $res = $storedFile->setFilePath($filepath); if ($res === -1) { return null; From 60803e5146fff038efc6f58a79d4ed91cd485fe0 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 16:33:46 -0400 Subject: [PATCH 12/23] cc-3936: Name of foreign key was given for easier access through propel. Also renamed phpName for ownerId to fit the existing convention. --- airtime_mvc/build/schema.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index c9f7befe9..e6a2f0719 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -75,8 +75,8 @@ - - + + From c83fad2546650283eda88cc651da5729648ca616 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 16:46:35 -0400 Subject: [PATCH 13/23] cc-3936: added owner to every file insert --- airtime_mvc/application/models/StoredFile.php | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index c1f13d4e9..e4a086150 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -47,7 +47,8 @@ class Application_Model_StoredFile "ftype" => "DbFtype", "language" => "DbLanguage", "replay_gain" => "DbReplayGain", - "directory" => "DbDirectory" + "directory" => "DbDirectory", + "owner_id" => "DbOwnerId" ); public function __construct() @@ -145,15 +146,38 @@ class Application_Model_StoredFile $this->_file->$method(null); } } else { + // if owner_id is already set we don't want to set it again. + $owner = $this->_file->getOwner(); + if($owner) { + $owner = null; + // if MDATA_OWNER_ID is not set then we default to the + // first admin user we find + if (!array_key_exists($md, 'MDATA_OWNER_ID')) { + $admins = Application_Model_User::getUsers(array('A')); + if (count($admins) > 0) { // found admin => pick first one + $owner = $admins[0]; + } + } + // get the user by id and set it like that + else { + // this is wrong + $user = CcSubjsQuery::create()->findPk($p_md['MDATA_OWNER_ID']); + if ($user) { + $owner = $user; + } + } + if ($owner) { + $this->_file->setDbOwner($owner); + } + } foreach ($p_md as $dbColumn => $mdValue) { //don't blank out name, defaults to original filename on first insertion to database. if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) { continue; } - // if owner is not present then we will if (isset($this->_dbMD[$dbColumn])) { $propelColumn = $this->_dbMD[$dbColumn]; - $method = "set$propelColumn"; + $method = "set$propelColumn"; Logging::info($method); $this->_file->$method($mdValue); } @@ -472,18 +496,6 @@ class Application_Model_StoredFile // path. Also note that mediamonitor normalizes the paths anyway // before passing them to php so it's not necessary to do this at all $filepath = str_replace("//", "/", $md['MDATA_KEY_FILEPATH']); - // if MDATA_OWNER_ID is not set then we default to the first admin user - // we find - if (!array_key_exists($md, 'MDATA_OWNER_ID')) { - $admins = Application_Model_User::getUsers(array('A')); - if (count($admins) > 0) { // found admin => pick first one - $md['MDATA_OWNER_ID'] = $admins[0]->getId(); - } - else { - Logging::info("Could not find any admin users in the database - for inserted file. Defaulting to NULL"); - } - } $res = $storedFile->setFilePath($filepath); if ($res === -1) { return null; From 4ad983f63c73eae303105aa1d11449ea05eb61a4 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 23 Aug 2012 17:52:28 -0400 Subject: [PATCH 14/23] cc-3936: applied schema changes --- airtime_mvc/application/models/StoredFile.php | 12 +-- airtime_mvc/application/models/User.php | 2 +- .../models/airtime/map/CcFilesTableMap.php | 4 +- .../models/airtime/map/CcSubjsTableMap.php | 2 +- .../models/airtime/om/BaseCcFiles.php | 68 +++++++-------- .../models/airtime/om/BaseCcFilesPeer.php | 28 +++--- .../models/airtime/om/BaseCcFilesQuery.php | 48 +++++------ .../models/airtime/om/BaseCcMusicDirs.php | 4 +- .../models/airtime/om/BaseCcSubjs.php | 86 +++++++++---------- .../models/airtime/om/BaseCcSubjsQuery.php | 26 +++--- 10 files changed, 141 insertions(+), 139 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index e4a086150..59f29820c 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -484,9 +484,11 @@ class Application_Model_StoredFile } $file = new CcFiles(); - $now = new DateTime("now", new DateTimeZone("UTC")); - $file->setDbUtime($now); - $file->setDbMtime($now); + //$now = new DateTime("now", new DateTimeZone("UTC")); + $file->setDbUtime(new DateTime("now", new DateTimeZone("UTC"))); + $file->setDbMtime(new DateTime("now", new DateTimeZone("UTC"))); + //$file->setDbUtime($now); + //$file->setDbMtime($now); $storedFile = new Application_Model_StoredFile(); $storedFile->_file = $file; @@ -605,9 +607,9 @@ class Application_Model_StoredFile ->find(); $res = array(); foreach ($files as $file) { - $storedFile = new Application_Model_StoredFile(); + $storedFile = new Application_Model_StoredFile(); $storedFile->_file = $file; - $res[] = $storedFile; + $res[] = $storedFile; } return $res; diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index fc6e6a3cf..05e13bf97 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -246,7 +246,7 @@ class Application_Model_User $sql = $sql_gen; $type = array_map( function($t) { - return "type = '{$type[$i]}'"; + return "type = '{$t}'"; }, $type); $sql_type = join(" OR ", $type); diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php index d7c258f19..c9757d2d3 100644 --- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php @@ -101,7 +101,7 @@ class CcFilesTableMap extends TableMap { $this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null); $this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null); $this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'VARCHAR', false, 16, null); - $this->addForeignKey('OWNER_ID', 'ownerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addForeignKey('OWNER_ID', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null); // validators } // initialize() @@ -110,7 +110,7 @@ class CcFilesTableMap extends TableMap { */ public function buildRelations() { - $this->addRelation('CcSubjsRelatedByownerId', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null); + $this->addRelation('Owner', '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('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null); $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); diff --git a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php index e30b7a8b5..7ed8469d8 100644 --- a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php @@ -59,7 +59,7 @@ class CcSubjsTableMap extends TableMap { */ public function buildRelations() { - $this->addRelation('CcFilesRelatedByownerId', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'owner_id', ), null, null); + $this->addRelation('CcFilesRelatedByDbOwnerId', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'owner_id', ), null, null); $this->addRelation('CcFilesRelatedByDbEditedby', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null); $this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null); $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php index 20c29d911..216ebc8f5 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php @@ -419,7 +419,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent /** * @var CcSubjs */ - protected $aCcSubjsRelatedByownerId; + protected $aOwner; /** * @var CcSubjs @@ -1220,7 +1220,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * * @return int */ - public function getownerId() + public function getDbOwnerId() { return $this->owner_id; } @@ -2615,7 +2615,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * @param int $v new value * @return CcFiles The current object (for fluent API support) */ - public function setownerId($v) + public function setDbOwnerId($v) { if ($v !== null) { $v = (int) $v; @@ -2626,12 +2626,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->modifiedColumns[] = CcFilesPeer::OWNER_ID; } - if ($this->aCcSubjsRelatedByownerId !== null && $this->aCcSubjsRelatedByownerId->getDbId() !== $v) { - $this->aCcSubjsRelatedByownerId = null; + if ($this->aOwner !== null && $this->aOwner->getDbId() !== $v) { + $this->aOwner = null; } return $this; - } // setownerId() + } // setDbOwnerId() /** * Indicates whether the columns in this object are only set to default values. @@ -2798,8 +2798,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->aCcSubjsRelatedByDbEditedby !== null && $this->editedby !== $this->aCcSubjsRelatedByDbEditedby->getDbId()) { $this->aCcSubjsRelatedByDbEditedby = null; } - if ($this->aCcSubjsRelatedByownerId !== null && $this->owner_id !== $this->aCcSubjsRelatedByownerId->getDbId()) { - $this->aCcSubjsRelatedByownerId = null; + if ($this->aOwner !== null && $this->owner_id !== $this->aOwner->getDbId()) { + $this->aOwner = null; } } // ensureConsistency @@ -2840,7 +2840,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? - $this->aCcSubjsRelatedByownerId = null; + $this->aOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; $this->collCcShowInstancess = null; @@ -2966,11 +2966,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aCcSubjsRelatedByownerId !== null) { - if ($this->aCcSubjsRelatedByownerId->isModified() || $this->aCcSubjsRelatedByownerId->isNew()) { - $affectedRows += $this->aCcSubjsRelatedByownerId->save($con); + if ($this->aOwner !== null) { + if ($this->aOwner->isModified() || $this->aOwner->isNew()) { + $affectedRows += $this->aOwner->save($con); } - $this->setCcSubjsRelatedByownerId($this->aCcSubjsRelatedByownerId); + $this->setOwner($this->aOwner); } if ($this->aCcSubjsRelatedByDbEditedby !== null) { @@ -3113,9 +3113,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aCcSubjsRelatedByownerId !== null) { - if (!$this->aCcSubjsRelatedByownerId->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjsRelatedByownerId->getValidationFailures()); + if ($this->aOwner !== null) { + if (!$this->aOwner->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aOwner->getValidationFailures()); } } @@ -3392,7 +3392,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this->getDbReplayGain(); break; case 63: - return $this->getownerId(); + return $this->getDbOwnerId(); break; default: return null; @@ -3481,11 +3481,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $keys[60] => $this->getDbSoundcloudLinkToFile(), $keys[61] => $this->getDbSoundCloundUploadTime(), $keys[62] => $this->getDbReplayGain(), - $keys[63] => $this->getownerId(), + $keys[63] => $this->getDbOwnerId(), ); if ($includeForeignObjects) { - if (null !== $this->aCcSubjsRelatedByownerId) { - $result['CcSubjsRelatedByownerId'] = $this->aCcSubjsRelatedByownerId->toArray($keyType, $includeLazyLoadColumns, true); + if (null !== $this->aOwner) { + $result['Owner'] = $this->aOwner->toArray($keyType, $includeLazyLoadColumns, true); } if (null !== $this->aCcSubjsRelatedByDbEditedby) { $result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->toArray($keyType, $includeLazyLoadColumns, true); @@ -3714,7 +3714,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->setDbReplayGain($value); break; case 63: - $this->setownerId($value); + $this->setDbOwnerId($value); break; } // switch() } @@ -3803,7 +3803,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if (array_key_exists($keys[60], $arr)) $this->setDbSoundcloudLinkToFile($arr[$keys[60]]); if (array_key_exists($keys[61], $arr)) $this->setDbSoundCloundUploadTime($arr[$keys[61]]); if (array_key_exists($keys[62], $arr)) $this->setDbReplayGain($arr[$keys[62]]); - if (array_key_exists($keys[63], $arr)) $this->setownerId($arr[$keys[63]]); + if (array_key_exists($keys[63], $arr)) $this->setDbOwnerId($arr[$keys[63]]); } /** @@ -4002,7 +4002,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $copyObj->setDbSoundcloudLinkToFile($this->soundcloud_link_to_file); $copyObj->setDbSoundCloundUploadTime($this->soundcloud_upload_time); $copyObj->setDbReplayGain($this->replay_gain); - $copyObj->setownerId($this->owner_id); + $copyObj->setDbOwnerId($this->owner_id); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -4085,20 +4085,20 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * @return CcFiles The current object (for fluent API support) * @throws PropelException */ - public function setCcSubjsRelatedByownerId(CcSubjs $v = null) + public function setOwner(CcSubjs $v = null) { if ($v === null) { - $this->setownerId(NULL); + $this->setDbOwnerId(NULL); } else { - $this->setownerId($v->getDbId()); + $this->setDbOwnerId($v->getDbId()); } - $this->aCcSubjsRelatedByownerId = $v; + $this->aOwner = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the CcSubjs object, it will not be re-added. if ($v !== null) { - $v->addCcFilesRelatedByownerId($this); + $v->addCcFilesRelatedByDbOwnerId($this); } return $this; @@ -4112,19 +4112,19 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * @return CcSubjs The associated CcSubjs object. * @throws PropelException */ - public function getCcSubjsRelatedByownerId(PropelPDO $con = null) + public function getOwner(PropelPDO $con = null) { - if ($this->aCcSubjsRelatedByownerId === null && ($this->owner_id !== null)) { - $this->aCcSubjsRelatedByownerId = CcSubjsQuery::create()->findPk($this->owner_id, $con); + if ($this->aOwner === null && ($this->owner_id !== null)) { + $this->aOwner = CcSubjsQuery::create()->findPk($this->owner_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->aCcSubjsRelatedByownerId->addCcFilessRelatedByownerId($this); + $this->aOwner->addCcFilessRelatedByDbOwnerId($this); */ } - return $this->aCcSubjsRelatedByownerId; + return $this->aOwner; } /** @@ -4952,7 +4952,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collCcPlaylistcontentss = null; $this->collCcBlockcontentss = null; $this->collCcSchedules = null; - $this->aCcSubjsRelatedByownerId = null; + $this->aOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php index 7d5a57a79..856e20127 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php @@ -239,8 +239,8 @@ abstract class BaseCcFilesPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', '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', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'ownerId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', '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', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'ownerId', ), + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', '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', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'DbOwnerId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', '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', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'dbOwnerId', ), BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::UTIME, self::LPTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, self::FILE_EXISTS, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, self::SOUNDCLOUD_UPLOAD_TIME, self::REPLAY_GAIN, self::OWNER_ID, ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', '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', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', ), BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', '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', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_id', ), @@ -254,8 +254,8 @@ abstract class BaseCcFilesPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbState' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'ownerId' => 63, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbState' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'ownerId' => 63, ), + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbState' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'DbOwnerId' => 63, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbState' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'dbOwnerId' => 63, ), BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MIME => 2, self::FTYPE => 3, self::DIRECTORY => 4, self::FILEPATH => 5, self::STATE => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::UTIME => 10, self::LPTIME => 11, self::MD5 => 12, self::TRACK_TITLE => 13, self::ARTIST_NAME => 14, self::BIT_RATE => 15, self::SAMPLE_RATE => 16, self::FORMAT => 17, self::LENGTH => 18, self::ALBUM_TITLE => 19, self::GENRE => 20, self::COMMENTS => 21, self::YEAR => 22, self::TRACK_NUMBER => 23, self::CHANNELS => 24, self::URL => 25, self::BPM => 26, self::RATING => 27, self::ENCODED_BY => 28, self::DISC_NUMBER => 29, self::MOOD => 30, self::LABEL => 31, self::COMPOSER => 32, self::ENCODER => 33, self::CHECKSUM => 34, self::LYRICS => 35, self::ORCHESTRA => 36, self::CONDUCTOR => 37, self::LYRICIST => 38, self::ORIGINAL_LYRICIST => 39, self::RADIO_STATION_NAME => 40, self::INFO_URL => 41, self::ARTIST_URL => 42, self::AUDIO_SOURCE_URL => 43, self::RADIO_STATION_URL => 44, self::BUY_THIS_URL => 45, self::ISRC_NUMBER => 46, self::CATALOG_NUMBER => 47, self::ORIGINAL_ARTIST => 48, self::COPYRIGHT => 49, self::REPORT_DATETIME => 50, self::REPORT_LOCATION => 51, self::REPORT_ORGANIZATION => 52, self::SUBJECT => 53, self::CONTRIBUTOR => 54, self::LANGUAGE => 55, self::FILE_EXISTS => 56, self::SOUNDCLOUD_ID => 57, self::SOUNDCLOUD_ERROR_CODE => 58, self::SOUNDCLOUD_ERROR_MSG => 59, self::SOUNDCLOUD_LINK_TO_FILE => 60, self::SOUNDCLOUD_UPLOAD_TIME => 61, self::REPLAY_GAIN => 62, self::OWNER_ID => 63, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'STATE' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, ), @@ -758,7 +758,7 @@ abstract class BaseCcFilesPeer { } /** - * Returns the number of rows matching criteria, joining the related CcSubjsRelatedByownerId table + * Returns the number of rows matching criteria, joining the related Owner table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -766,7 +766,7 @@ abstract class BaseCcFilesPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinCcSubjsRelatedByownerId(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinOwner(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; @@ -916,7 +916,7 @@ abstract class BaseCcFilesPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinCcSubjsRelatedByownerId(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; @@ -962,7 +962,7 @@ abstract class BaseCcFilesPeer { } // if obj2 already loaded // Add the $obj1 (CcFiles) to $obj2 (CcSubjs) - $obj2->addCcFilesRelatedByownerId($obj1); + $obj2->addCcFilesRelatedByDbOwnerId($obj1); } // if joined row was not null @@ -1227,7 +1227,7 @@ abstract class BaseCcFilesPeer { } // if obj2 loaded // Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs) - $obj2->addCcFilesRelatedByownerId($obj1); + $obj2->addCcFilesRelatedByDbOwnerId($obj1); } // if joined row not null // Add objects for joined CcSubjs rows @@ -1274,7 +1274,7 @@ abstract class BaseCcFilesPeer { /** - * Returns the number of rows matching criteria, joining the related CcSubjsRelatedByownerId table + * Returns the number of rows matching criteria, joining the related Owner table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -1282,7 +1282,7 @@ abstract class BaseCcFilesPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinAllExceptCcSubjsRelatedByownerId(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinAllExceptOwner(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; @@ -1426,7 +1426,7 @@ abstract class BaseCcFilesPeer { /** - * Selects a collection of CcFiles objects pre-filled with all related objects except CcSubjsRelatedByownerId. + * Selects a collection of CcFiles objects pre-filled with all related objects except Owner. * * @param Criteria $criteria * @param PropelPDO $con @@ -1435,7 +1435,7 @@ abstract class BaseCcFilesPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinAllExceptCcSubjsRelatedByownerId(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinAllExceptOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; @@ -1638,7 +1638,7 @@ abstract class BaseCcFilesPeer { } // if $obj2 already loaded // Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs) - $obj2->addCcFilesRelatedByownerId($obj1); + $obj2->addCcFilesRelatedByDbOwnerId($obj1); } // if joined row is not null diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php index 188cce5a1..4734400b7 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -69,7 +69,7 @@ * @method CcFilesQuery orderByDbSoundcloudLinkToFile($order = Criteria::ASC) Order by the soundcloud_link_to_file column * @method CcFilesQuery orderByDbSoundCloundUploadTime($order = Criteria::ASC) Order by the soundcloud_upload_time column * @method CcFilesQuery orderByDbReplayGain($order = Criteria::ASC) Order by the replay_gain column - * @method CcFilesQuery orderByownerId($order = Criteria::ASC) Order by the owner_id column + * @method CcFilesQuery orderByDbOwnerId($order = Criteria::ASC) Order by the owner_id column * * @method CcFilesQuery groupByDbId() Group by the id column * @method CcFilesQuery groupByDbName() Group by the name column @@ -134,15 +134,15 @@ * @method CcFilesQuery groupByDbSoundcloudLinkToFile() Group by the soundcloud_link_to_file column * @method CcFilesQuery groupByDbSoundCloundUploadTime() Group by the soundcloud_upload_time column * @method CcFilesQuery groupByDbReplayGain() Group by the replay_gain column - * @method CcFilesQuery groupByownerId() Group by the owner_id column + * @method CcFilesQuery groupByDbOwnerId() Group by the owner_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 * @method CcFilesQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method CcFilesQuery leftJoinCcSubjsRelatedByownerId($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByownerId relation - * @method CcFilesQuery rightJoinCcSubjsRelatedByownerId($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByownerId relation - * @method CcFilesQuery innerJoinCcSubjsRelatedByownerId($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjsRelatedByownerId relation + * @method CcFilesQuery leftJoinOwner($relationAlias = '') Adds a LEFT JOIN clause to the query using the Owner relation + * @method CcFilesQuery rightJoinOwner($relationAlias = '') Adds a RIGHT JOIN clause to the query using the Owner relation + * @method CcFilesQuery innerJoinOwner($relationAlias = '') Adds a INNER JOIN clause to the query using the Owner relation * * @method CcFilesQuery leftJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation @@ -234,7 +234,7 @@ * @method CcFiles findOneByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return the first CcFiles filtered by the soundcloud_link_to_file column * @method CcFiles findOneByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return the first CcFiles filtered by the soundcloud_upload_time column * @method CcFiles findOneByDbReplayGain(string $replay_gain) Return the first CcFiles filtered by the replay_gain column - * @method CcFiles findOneByownerId(int $owner_id) Return the first CcFiles filtered by the owner_id column + * @method CcFiles findOneByDbOwnerId(int $owner_id) Return the first CcFiles filtered by the owner_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 @@ -299,7 +299,7 @@ * @method array findByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return CcFiles objects filtered by the soundcloud_link_to_file column * @method array findByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return CcFiles objects filtered by the soundcloud_upload_time column * @method array findByDbReplayGain(string $replay_gain) Return CcFiles objects filtered by the replay_gain column - * @method array findByownerId(int $owner_id) Return CcFiles objects filtered by the owner_id column + * @method array findByDbOwnerId(int $owner_id) Return CcFiles objects filtered by the owner_id column * * @package propel.generator.airtime.om */ @@ -1914,22 +1914,22 @@ abstract class BaseCcFilesQuery extends ModelCriteria /** * Filter the query on the owner_id column * - * @param int|array $ownerId The value to use as filter. + * @param int|array $dbOwnerId The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcFilesQuery The current query, for fluid interface */ - public function filterByownerId($ownerId = null, $comparison = null) + public function filterByDbOwnerId($dbOwnerId = null, $comparison = null) { - if (is_array($ownerId)) { + if (is_array($dbOwnerId)) { $useMinMax = false; - if (isset($ownerId['min'])) { - $this->addUsingAlias(CcFilesPeer::OWNER_ID, $ownerId['min'], Criteria::GREATER_EQUAL); + if (isset($dbOwnerId['min'])) { + $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($ownerId['max'])) { - $this->addUsingAlias(CcFilesPeer::OWNER_ID, $ownerId['max'], Criteria::LESS_EQUAL); + if (isset($dbOwnerId['max'])) { + $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -1939,7 +1939,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcFilesPeer::OWNER_ID, $ownerId, $comparison); + return $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId, $comparison); } /** @@ -1950,24 +1950,24 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcFilesQuery The current query, for fluid interface */ - public function filterByCcSubjsRelatedByownerId($ccSubjs, $comparison = null) + public function filterByOwner($ccSubjs, $comparison = null) { return $this ->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->getDbId(), $comparison); } /** - * Adds a JOIN clause to the query using the CcSubjsRelatedByownerId relation + * Adds a JOIN clause to the query using the Owner 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 joinCcSubjsRelatedByownerId($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function joinOwner($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjsRelatedByownerId'); + $relationMap = $tableMap->getRelation('Owner'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -1982,14 +1982,14 @@ abstract class BaseCcFilesQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'CcSubjsRelatedByownerId'); + $this->addJoinObject($join, 'Owner'); } return $this; } /** - * Use the CcSubjsRelatedByownerId relation CcSubjs object + * Use the Owner relation CcSubjs object * * @see useQuery() * @@ -1999,11 +1999,11 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcSubjsQuery A secondary query class using the current class as primary query */ - public function useCcSubjsRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function useOwnerQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { return $this - ->joinCcSubjsRelatedByownerId($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByownerId', 'CcSubjsQuery'); + ->joinOwner($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Owner', 'CcSubjsQuery'); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php index 87984ef97..c960bfbe7 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php @@ -999,10 +999,10 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array CcFiles[] List of CcFiles objects */ - public function getCcFilessJoinCcSubjsRelatedByownerId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public function getCcFilessJoinOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = CcFilesQuery::create(null, $criteria); - $query->joinWith('CcSubjsRelatedByownerId', $join_behavior); + $query->joinWith('Owner', $join_behavior); return $this->getCcFiless($query, $con); } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php index 6e42a4c9c..02c9239ff 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php @@ -111,7 +111,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent /** * @var array CcFiles[] Collection to store aggregation of CcFiles objects. */ - protected $collCcFilessRelatedByownerId; + protected $collCcFilessRelatedByDbOwnerId; /** * @var array CcFiles[] Collection to store aggregation of CcFiles objects. @@ -826,7 +826,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? - $this->collCcFilessRelatedByownerId = null; + $this->collCcFilessRelatedByDbOwnerId = null; $this->collCcFilessRelatedByDbEditedby = null; @@ -977,8 +977,8 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } - if ($this->collCcFilessRelatedByownerId !== null) { - foreach ($this->collCcFilessRelatedByownerId as $referrerFK) { + if ($this->collCcFilessRelatedByDbOwnerId !== null) { + foreach ($this->collCcFilessRelatedByDbOwnerId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } @@ -1120,8 +1120,8 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } - if ($this->collCcFilessRelatedByownerId !== null) { - foreach ($this->collCcFilessRelatedByownerId as $referrerFK) { + if ($this->collCcFilessRelatedByDbOwnerId !== null) { + foreach ($this->collCcFilessRelatedByDbOwnerId as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } @@ -1510,9 +1510,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getCcFilessRelatedByownerId() as $relObj) { + foreach ($this->getCcFilessRelatedByDbOwnerId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcFilesRelatedByownerId($relObj->copy($deepCopy)); + $copyObj->addCcFilesRelatedByDbOwnerId($relObj->copy($deepCopy)); } } @@ -1610,32 +1610,32 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } /** - * Clears out the collCcFilessRelatedByownerId collection + * Clears out the collCcFilessRelatedByDbOwnerId 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 void - * @see addCcFilessRelatedByownerId() + * @see addCcFilessRelatedByDbOwnerId() */ - public function clearCcFilessRelatedByownerId() + public function clearCcFilessRelatedByDbOwnerId() { - $this->collCcFilessRelatedByownerId = null; // important to set this to NULL since that means it is uninitialized + $this->collCcFilessRelatedByDbOwnerId = null; // important to set this to NULL since that means it is uninitialized } /** - * Initializes the collCcFilessRelatedByownerId collection. + * Initializes the collCcFilessRelatedByDbOwnerId collection. * - * By default this just sets the collCcFilessRelatedByownerId collection to an empty array (like clearcollCcFilessRelatedByownerId()); + * By default this just sets the collCcFilessRelatedByDbOwnerId collection to an empty array (like clearcollCcFilessRelatedByDbOwnerId()); * 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. * * @return void */ - public function initCcFilessRelatedByownerId() + public function initCcFilessRelatedByDbOwnerId() { - $this->collCcFilessRelatedByownerId = new PropelObjectCollection(); - $this->collCcFilessRelatedByownerId->setModel('CcFiles'); + $this->collCcFilessRelatedByDbOwnerId = new PropelObjectCollection(); + $this->collCcFilessRelatedByDbOwnerId->setModel('CcFiles'); } /** @@ -1652,23 +1652,23 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @return PropelCollection|array CcFiles[] List of CcFiles objects * @throws PropelException */ - public function getCcFilessRelatedByownerId($criteria = null, PropelPDO $con = null) + public function getCcFilessRelatedByDbOwnerId($criteria = null, PropelPDO $con = null) { - if(null === $this->collCcFilessRelatedByownerId || null !== $criteria) { - if ($this->isNew() && null === $this->collCcFilessRelatedByownerId) { + if(null === $this->collCcFilessRelatedByDbOwnerId || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFilessRelatedByDbOwnerId) { // return empty collection - $this->initCcFilessRelatedByownerId(); + $this->initCcFilessRelatedByDbOwnerId(); } else { - $collCcFilessRelatedByownerId = CcFilesQuery::create(null, $criteria) - ->filterByCcSubjsRelatedByownerId($this) + $collCcFilessRelatedByDbOwnerId = CcFilesQuery::create(null, $criteria) + ->filterByOwner($this) ->find($con); if (null !== $criteria) { - return $collCcFilessRelatedByownerId; + return $collCcFilessRelatedByDbOwnerId; } - $this->collCcFilessRelatedByownerId = $collCcFilessRelatedByownerId; + $this->collCcFilessRelatedByDbOwnerId = $collCcFilessRelatedByDbOwnerId; } } - return $this->collCcFilessRelatedByownerId; + return $this->collCcFilessRelatedByDbOwnerId; } /** @@ -1680,10 +1680,10 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @return int Count of related CcFiles objects. * @throws PropelException */ - public function countCcFilessRelatedByownerId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + public function countCcFilessRelatedByDbOwnerId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { - if(null === $this->collCcFilessRelatedByownerId || null !== $criteria) { - if ($this->isNew() && null === $this->collCcFilessRelatedByownerId) { + if(null === $this->collCcFilessRelatedByDbOwnerId || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFilessRelatedByDbOwnerId) { return 0; } else { $query = CcFilesQuery::create(null, $criteria); @@ -1691,11 +1691,11 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $query->distinct(); } return $query - ->filterByCcSubjsRelatedByownerId($this) + ->filterByOwner($this) ->count($con); } } else { - return count($this->collCcFilessRelatedByownerId); + return count($this->collCcFilessRelatedByDbOwnerId); } } @@ -1707,14 +1707,14 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @return void * @throws PropelException */ - public function addCcFilesRelatedByownerId(CcFiles $l) + public function addCcFilesRelatedByDbOwnerId(CcFiles $l) { - if ($this->collCcFilessRelatedByownerId === null) { - $this->initCcFilessRelatedByownerId(); + if ($this->collCcFilessRelatedByDbOwnerId === null) { + $this->initCcFilessRelatedByDbOwnerId(); } - if (!$this->collCcFilessRelatedByownerId->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcFilessRelatedByownerId[]= $l; - $l->setCcSubjsRelatedByownerId($this); + if (!$this->collCcFilessRelatedByDbOwnerId->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcFilessRelatedByDbOwnerId[]= $l; + $l->setOwner($this); } } @@ -1724,7 +1724,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * 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 CcFilessRelatedByownerId from storage. + * 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 @@ -1735,12 +1735,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array CcFiles[] List of CcFiles objects */ - public function getCcFilessRelatedByownerIdJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public function getCcFilessRelatedByDbOwnerIdJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = CcFilesQuery::create(null, $criteria); $query->joinWith('CcMusicDirs', $join_behavior); - return $this->getCcFilessRelatedByownerId($query, $con); + return $this->getCcFilessRelatedByDbOwnerId($query, $con); } /** @@ -2704,8 +2704,8 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collCcFilessRelatedByownerId) { - foreach ((array) $this->collCcFilessRelatedByownerId as $o) { + if ($this->collCcFilessRelatedByDbOwnerId) { + foreach ((array) $this->collCcFilessRelatedByDbOwnerId as $o) { $o->clearAllReferences($deep); } } @@ -2751,7 +2751,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } // if ($deep) - $this->collCcFilessRelatedByownerId = null; + $this->collCcFilessRelatedByDbOwnerId = null; $this->collCcFilessRelatedByDbEditedby = null; $this->collCcPermss = null; $this->collCcShowHostss = null; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php index 7487f7952..38703d208 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php @@ -38,9 +38,9 @@ * @method CcSubjsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcSubjsQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method CcSubjsQuery leftJoinCcFilesRelatedByownerId($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFilesRelatedByownerId relation - * @method CcSubjsQuery rightJoinCcFilesRelatedByownerId($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByownerId relation - * @method CcSubjsQuery innerJoinCcFilesRelatedByownerId($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFilesRelatedByownerId relation + * @method CcSubjsQuery leftJoinCcFilesRelatedByDbOwnerId($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation + * @method CcSubjsQuery rightJoinCcFilesRelatedByDbOwnerId($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation + * @method CcSubjsQuery innerJoinCcFilesRelatedByDbOwnerId($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation * * @method CcSubjsQuery leftJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation * @method CcSubjsQuery rightJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation @@ -529,24 +529,24 @@ abstract class BaseCcSubjsQuery extends ModelCriteria * * @return CcSubjsQuery The current query, for fluid interface */ - public function filterByCcFilesRelatedByownerId($ccFiles, $comparison = null) + public function filterByCcFilesRelatedByDbOwnerId($ccFiles, $comparison = null) { return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getownerId(), $comparison); + ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbOwnerId(), $comparison); } /** - * Adds a JOIN clause to the query using the CcFilesRelatedByownerId relation + * Adds a JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return CcSubjsQuery The current query, for fluid interface */ - public function joinCcFilesRelatedByownerId($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function joinCcFilesRelatedByDbOwnerId($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcFilesRelatedByownerId'); + $relationMap = $tableMap->getRelation('CcFilesRelatedByDbOwnerId'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -561,14 +561,14 @@ abstract class BaseCcSubjsQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'CcFilesRelatedByownerId'); + $this->addJoinObject($join, 'CcFilesRelatedByDbOwnerId'); } return $this; } /** - * Use the CcFilesRelatedByownerId relation CcFiles object + * Use the CcFilesRelatedByDbOwnerId relation CcFiles object * * @see useQuery() * @@ -578,11 +578,11 @@ abstract class BaseCcSubjsQuery extends ModelCriteria * * @return CcFilesQuery A secondary query class using the current class as primary query */ - public function useCcFilesRelatedByownerIdQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function useCcFilesRelatedByDbOwnerIdQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { return $this - ->joinCcFilesRelatedByownerId($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByownerId', 'CcFilesQuery'); + ->joinCcFilesRelatedByDbOwnerId($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByDbOwnerId', 'CcFilesQuery'); } /** From 19a5a8f9923a3c692b51251f778322d82d620e4e Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 24 Aug 2012 10:20:23 -0400 Subject: [PATCH 15/23] cc-3936: fixed wrong argument order bug. --- airtime_mvc/application/models/StoredFile.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 59f29820c..5ad90f27f 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -97,7 +97,6 @@ class Application_Model_StoredFile */ public function setMetadata($p_md=null) { - Logging::info("entered setMetadata"); if (is_null($p_md)) { $this->setDbColMetadata(); } else { @@ -146,13 +145,13 @@ class Application_Model_StoredFile $this->_file->$method(null); } } else { - // if owner_id is already set we don't want to set it again. $owner = $this->_file->getOwner(); - if($owner) { + // if owner_id is already set we don't want to set it again. + if(!$owner) { // no owner detected, we try to assign one. $owner = null; // if MDATA_OWNER_ID is not set then we default to the // first admin user we find - if (!array_key_exists($md, 'MDATA_OWNER_ID')) { + if (!array_key_exists('MDATA_OWNER_ID', $p_md)) { $admins = Application_Model_User::getUsers(array('A')); if (count($admins) > 0) { // found admin => pick first one $owner = $admins[0]; @@ -160,8 +159,8 @@ class Application_Model_StoredFile } // get the user by id and set it like that else { - // this is wrong - $user = CcSubjsQuery::create()->findPk($p_md['MDATA_OWNER_ID']); + $user = CcSubjsQuery::create() + ->findPk($p_md['MDATA_OWNER_ID']); if ($user) { $owner = $user; } @@ -781,7 +780,7 @@ class Application_Model_StoredFile // Settings $cleanupTargetDir = false; // Remove old files - $maxFileAge = 60 * 60; // Temp file age in seconds + $maxFileAge = 60 * 60; // Temp file age in seconds // 5 minutes execution time @set_time_limit(5 * 60); From 857be6b7024480ea7363460ff880d866618d9481 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 24 Aug 2012 11:09:38 -0400 Subject: [PATCH 16/23] cc-3936: Removed manual path concatenation. Fixed setting owner of file. --- airtime_mvc/application/models/StoredFile.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 5ad90f27f..87841be30 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -166,7 +166,9 @@ class Application_Model_StoredFile } } if ($owner) { - $this->_file->setDbOwner($owner); + Logging::info("Suppose to to set owner as ". + var_export($owner,true)); + $this->_file->setFkOwner($owner); } } foreach ($p_md as $dbColumn => $mdValue) { @@ -396,12 +398,11 @@ class Application_Model_StoredFile */ public function getFilePath() { - $music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory()); + $music_dir = Application_Model_MusicDir::getDirByPK($this-> + _file->getDbDirectory()); $directory = $music_dir->getDirectory(); - - $filepath = $this->_file->getDbFilepath(); - - return $directory.$filepath; + $filepath = $this->_file->getDbFilepath(); + return OsPath::join($directory, $filepath); } /** @@ -483,11 +484,9 @@ class Application_Model_StoredFile } $file = new CcFiles(); - //$now = new DateTime("now", new DateTimeZone("UTC")); - $file->setDbUtime(new DateTime("now", new DateTimeZone("UTC"))); - $file->setDbMtime(new DateTime("now", new DateTimeZone("UTC"))); - //$file->setDbUtime($now); - //$file->setDbMtime($now); + $now = new DateTime("now", new DateTimeZone("UTC")); + $file->setDbUtime($now); + $file->setDbMtime($now); $storedFile = new Application_Model_StoredFile(); $storedFile->_file = $file; @@ -496,6 +495,7 @@ class Application_Model_StoredFile // TODO : it might be better to just call OsPath::normpath on the file // path. Also note that mediamonitor normalizes the paths anyway // before passing them to php so it's not necessary to do this at all + $filepath = str_replace("//", "/", $md['MDATA_KEY_FILEPATH']); $res = $storedFile->setFilePath($filepath); if ($res === -1) { From 4efdf71aea2f247b846212c3e57308eb915ebbd1 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 24 Aug 2012 11:10:05 -0400 Subject: [PATCH 17/23] cc-3936: Made phpName of foreign key conform to Fk prefix convention. --- .../models/airtime/map/CcFilesTableMap.php | 2 +- .../models/airtime/om/BaseCcFiles.php | 46 +++++++++---------- .../models/airtime/om/BaseCcFilesPeer.php | 14 +++--- .../models/airtime/om/BaseCcFilesQuery.php | 24 +++++----- .../models/airtime/om/BaseCcMusicDirs.php | 4 +- .../models/airtime/om/BaseCcSubjs.php | 6 +-- airtime_mvc/build/schema.xml | 2 +- 7 files changed, 49 insertions(+), 49 deletions(-) diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php index c9757d2d3..9c00c0b68 100644 --- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php @@ -110,7 +110,7 @@ class CcFilesTableMap extends TableMap { */ public function buildRelations() { - $this->addRelation('Owner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null); + $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('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null); $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php index 216ebc8f5..a18d65dca 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php @@ -419,7 +419,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent /** * @var CcSubjs */ - protected $aOwner; + protected $aFkOwner; /** * @var CcSubjs @@ -2626,8 +2626,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->modifiedColumns[] = CcFilesPeer::OWNER_ID; } - if ($this->aOwner !== null && $this->aOwner->getDbId() !== $v) { - $this->aOwner = null; + if ($this->aFkOwner !== null && $this->aFkOwner->getDbId() !== $v) { + $this->aFkOwner = null; } return $this; @@ -2798,8 +2798,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->aCcSubjsRelatedByDbEditedby !== null && $this->editedby !== $this->aCcSubjsRelatedByDbEditedby->getDbId()) { $this->aCcSubjsRelatedByDbEditedby = null; } - if ($this->aOwner !== null && $this->owner_id !== $this->aOwner->getDbId()) { - $this->aOwner = null; + if ($this->aFkOwner !== null && $this->owner_id !== $this->aFkOwner->getDbId()) { + $this->aFkOwner = null; } } // ensureConsistency @@ -2840,7 +2840,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($deep) { // also de-associate any related objects? - $this->aOwner = null; + $this->aFkOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; $this->collCcShowInstancess = null; @@ -2966,11 +2966,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aOwner !== null) { - if ($this->aOwner->isModified() || $this->aOwner->isNew()) { - $affectedRows += $this->aOwner->save($con); + if ($this->aFkOwner !== null) { + if ($this->aFkOwner->isModified() || $this->aFkOwner->isNew()) { + $affectedRows += $this->aFkOwner->save($con); } - $this->setOwner($this->aOwner); + $this->setFkOwner($this->aFkOwner); } if ($this->aCcSubjsRelatedByDbEditedby !== null) { @@ -3113,9 +3113,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aOwner !== null) { - if (!$this->aOwner->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aOwner->getValidationFailures()); + if ($this->aFkOwner !== null) { + if (!$this->aFkOwner->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aFkOwner->getValidationFailures()); } } @@ -3484,8 +3484,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $keys[63] => $this->getDbOwnerId(), ); if ($includeForeignObjects) { - if (null !== $this->aOwner) { - $result['Owner'] = $this->aOwner->toArray($keyType, $includeLazyLoadColumns, true); + if (null !== $this->aFkOwner) { + $result['FkOwner'] = $this->aFkOwner->toArray($keyType, $includeLazyLoadColumns, true); } if (null !== $this->aCcSubjsRelatedByDbEditedby) { $result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->toArray($keyType, $includeLazyLoadColumns, true); @@ -4085,7 +4085,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * @return CcFiles The current object (for fluent API support) * @throws PropelException */ - public function setOwner(CcSubjs $v = null) + public function setFkOwner(CcSubjs $v = null) { if ($v === null) { $this->setDbOwnerId(NULL); @@ -4093,7 +4093,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->setDbOwnerId($v->getDbId()); } - $this->aOwner = $v; + $this->aFkOwner = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the CcSubjs object, it will not be re-added. @@ -4112,19 +4112,19 @@ abstract class BaseCcFiles extends BaseObject implements Persistent * @return CcSubjs The associated CcSubjs object. * @throws PropelException */ - public function getOwner(PropelPDO $con = null) + public function getFkOwner(PropelPDO $con = null) { - if ($this->aOwner === null && ($this->owner_id !== null)) { - $this->aOwner = CcSubjsQuery::create()->findPk($this->owner_id, $con); + if ($this->aFkOwner === null && ($this->owner_id !== null)) { + $this->aFkOwner = CcSubjsQuery::create()->findPk($this->owner_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->aOwner->addCcFilessRelatedByDbOwnerId($this); + $this->aFkOwner->addCcFilessRelatedByDbOwnerId($this); */ } - return $this->aOwner; + return $this->aFkOwner; } /** @@ -4952,7 +4952,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collCcPlaylistcontentss = null; $this->collCcBlockcontentss = null; $this->collCcSchedules = null; - $this->aOwner = null; + $this->aFkOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php index 856e20127..c155c3c2a 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php @@ -758,7 +758,7 @@ abstract class BaseCcFilesPeer { } /** - * Returns the number of rows matching criteria, joining the related Owner table + * Returns the number of rows matching criteria, joining the related FkOwner table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -766,7 +766,7 @@ abstract class BaseCcFilesPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinOwner(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinFkOwner(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; @@ -916,7 +916,7 @@ abstract class BaseCcFilesPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinFkOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; @@ -1274,7 +1274,7 @@ abstract class BaseCcFilesPeer { /** - * Returns the number of rows matching criteria, joining the related Owner table + * Returns the number of rows matching criteria, joining the related FkOwner table * * @param Criteria $criteria * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. @@ -1282,7 +1282,7 @@ abstract class BaseCcFilesPeer { * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return int Number of matching rows. */ - public static function doCountJoinAllExceptOwner(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doCountJoinAllExceptFkOwner(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; @@ -1426,7 +1426,7 @@ abstract class BaseCcFilesPeer { /** - * Selects a collection of CcFiles objects pre-filled with all related objects except Owner. + * Selects a collection of CcFiles objects pre-filled with all related objects except FkOwner. * * @param Criteria $criteria * @param PropelPDO $con @@ -1435,7 +1435,7 @@ abstract class BaseCcFilesPeer { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectJoinAllExceptOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public static function doSelectJoinAllExceptFkOwner(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php index 4734400b7..793bab857 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -140,9 +140,9 @@ * @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcFilesQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method CcFilesQuery leftJoinOwner($relationAlias = '') Adds a LEFT JOIN clause to the query using the Owner relation - * @method CcFilesQuery rightJoinOwner($relationAlias = '') Adds a RIGHT JOIN clause to the query using the Owner relation - * @method CcFilesQuery innerJoinOwner($relationAlias = '') Adds a INNER JOIN clause to the query using the Owner relation + * @method CcFilesQuery leftJoinFkOwner($relationAlias = '') Adds a LEFT JOIN clause to the query using the FkOwner relation + * @method CcFilesQuery rightJoinFkOwner($relationAlias = '') Adds a RIGHT JOIN clause to the query using the FkOwner relation + * @method CcFilesQuery innerJoinFkOwner($relationAlias = '') Adds a INNER JOIN clause to the query using the FkOwner relation * * @method CcFilesQuery leftJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation @@ -1950,24 +1950,24 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcFilesQuery The current query, for fluid interface */ - public function filterByOwner($ccSubjs, $comparison = null) + public function filterByFkOwner($ccSubjs, $comparison = null) { return $this ->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->getDbId(), $comparison); } /** - * Adds a JOIN clause to the query using the Owner relation + * Adds a JOIN clause to the query using the FkOwner 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 joinOwner($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function joinFkOwner($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Owner'); + $relationMap = $tableMap->getRelation('FkOwner'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -1982,14 +1982,14 @@ abstract class BaseCcFilesQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'Owner'); + $this->addJoinObject($join, 'FkOwner'); } return $this; } /** - * Use the Owner relation CcSubjs object + * Use the FkOwner relation CcSubjs object * * @see useQuery() * @@ -1999,11 +1999,11 @@ abstract class BaseCcFilesQuery extends ModelCriteria * * @return CcSubjsQuery A secondary query class using the current class as primary query */ - public function useOwnerQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + public function useFkOwnerQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) { return $this - ->joinOwner($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Owner', 'CcSubjsQuery'); + ->joinFkOwner($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'FkOwner', 'CcSubjsQuery'); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php index c960bfbe7..f58915945 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php @@ -999,10 +999,10 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array CcFiles[] List of CcFiles objects */ - public function getCcFilessJoinOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + public function getCcFilessJoinFkOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = CcFilesQuery::create(null, $criteria); - $query->joinWith('Owner', $join_behavior); + $query->joinWith('FkOwner', $join_behavior); return $this->getCcFiless($query, $con); } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php index 02c9239ff..c335d7158 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php @@ -1660,7 +1660,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->initCcFilessRelatedByDbOwnerId(); } else { $collCcFilessRelatedByDbOwnerId = CcFilesQuery::create(null, $criteria) - ->filterByOwner($this) + ->filterByFkOwner($this) ->find($con); if (null !== $criteria) { return $collCcFilessRelatedByDbOwnerId; @@ -1691,7 +1691,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $query->distinct(); } return $query - ->filterByOwner($this) + ->filterByFkOwner($this) ->count($con); } } else { @@ -1714,7 +1714,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } if (!$this->collCcFilessRelatedByDbOwnerId->contains($l)) { // only add it if the **same** object is not already associated $this->collCcFilessRelatedByDbOwnerId[]= $l; - $l->setOwner($this); + $l->setFkOwner($this); } } diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index e6a2f0719..46dca8370 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -76,7 +76,7 @@ - + From 2e505ee970a52b590c7c32d3723b2fe32c62176d Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 24 Aug 2012 11:47:32 -0400 Subject: [PATCH 18/23] CC-4246: Smart Playlist: Click shuffle button will shuffle the contents multiple times -small code fix --- airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js index 2f8fc8260..0a5bfc182 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js @@ -333,9 +333,9 @@ function setupUI() { shuffleButton.removeAttr('disabled'); } } else if (!shuffleButton.hasClass('ui-state-disabled')) { - if (!shuffleButton.hasClass('ui-state-disabled')) { - shuffleButton.addClass('ui-state-disabled'); + if (shuffleButton.attr('disabled') === undefined) { shuffleButton.attr('disabled', 'disabled'); + shuffleButton.addClass('ui-state-disabled'); } } From ffa4c131ee8322facf7d39e39c45d54a8501d221 Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 24 Aug 2012 11:50:02 -0400 Subject: [PATCH 19/23] CC-4246: Smart Playlist: Click shuffle button will shuffle the contents multiple times -code refactor --- .../public/js/airtime/playlist/smart_blockbuilder.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js index 0a5bfc182..1c914ea47 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js @@ -328,15 +328,11 @@ function setupUI() { if (plContents.text() !== 'Empty playlist') { if (shuffleButton.hasClass('ui-state-disabled')) { shuffleButton.removeClass('ui-state-disabled'); - } - if (shuffleButton.attr('disabled') !== undefined) { shuffleButton.removeAttr('disabled'); } } else if (!shuffleButton.hasClass('ui-state-disabled')) { - if (shuffleButton.attr('disabled') === undefined) { - shuffleButton.attr('disabled', 'disabled'); - shuffleButton.addClass('ui-state-disabled'); - } + shuffleButton.addClass('ui-state-disabled'); + shuffleButton.attr('disabled', 'disabled'); } var dynamic_length = target_length; From e53c20bbcdc3f02a0e85975fce0f5c9b963e4cfe Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 24 Aug 2012 12:36:20 -0400 Subject: [PATCH 20/23] cc-3936: added method to make it easier to get users of a certain type. --- airtime_mvc/application/models/User.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 05e13bf97..0aa8a4236 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -238,6 +238,9 @@ class Application_Model_User return $user; } + public static function getUsersOfType($type) { + return CcSubjsQuery::create()->filterByDbType($type)->find(); + } public static function getUsers(array $type, $search=null) { $con = Propel::getConnection(); From 5841cb70662dcc9d8214f4ea3b4ebf6cdf32f23d Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 24 Aug 2012 12:37:16 -0400 Subject: [PATCH 21/23] cc-3936: Made it so that identifer file is written before the file itself so that media monitor always has the identifier file before the song itself. --- airtime_mvc/application/models/StoredFile.php | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 87841be30..7a53b3ab2 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -918,22 +918,6 @@ class Application_Model_StoredFile // Did all the checks for realz, now trying to copy $audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName); - Logging::info("copyFileToStor: moving file $audio_file to $audio_stor"); - // Martin K.: changed to rename: Much less load + quicker since this is - // an atomic operation - if (@rename($audio_file, $audio_stor) === false) { - //something went wrong likely there wasn't enough space in the audio_stor to move the file too. - //warn the user that the file wasn't uploaded and they should check if there is enough disk space. - unlink($audio_file); //remove the file after failed rename - return array( - "code" => 108, - "message" => " - The file was not uploaded, this error can occur if the computer - hard drive does not have enough disk space or the stor - directory does not have correct write permissions."); - } - // Now that we successfully added this file, we will add another tag - // file that will identify the user that owns it $uid = Application_Model_User::getCurrentUser()->getId(); $id_file = "$audio_stor.identifier"; if (file_put_contents($id_file,$uid) === false) { @@ -945,6 +929,23 @@ class Application_Model_StoredFile Logging::info("Successfully written identification file for uploaded '$audio_stor'"); } + Logging::info("copyFileToStor: moving file $audio_file to $audio_stor"); + // Martin K.: changed to rename: Much less load + quicker since this is + // an atomic operation + if (@rename($audio_file, $audio_stor) === false) { + //something went wrong likely there wasn't enough space in the audio_stor to move the file too. + //warn the user that the file wasn't uploaded and they should check if there is enough disk space. + unlink($audio_file); //remove the file after failed rename + unlink($id_file); // Also remove the identifier file + return array( + "code" => 108, + "message" => " + The file was not uploaded, this error can occur if the computer + hard drive does not have enough disk space or the stor + directory does not have correct write permissions."); + } + // Now that we successfully added this file, we will add another tag + // file that will identify the user that owns it return null; } From 72847702269657f34b8e5c25ad5f21d107e87f9b Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 24 Aug 2012 12:38:33 -0400 Subject: [PATCH 22/23] cc-3936: Changed setting of owner when modifying/inserting metadata. --- airtime_mvc/application/models/StoredFile.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 7a53b3ab2..da01d8c54 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -145,14 +145,15 @@ class Application_Model_StoredFile $this->_file->$method(null); } } else { - $owner = $this->_file->getOwner(); + $owner = $this->_file->getFkOwner(); // if owner_id is already set we don't want to set it again. if(!$owner) { // no owner detected, we try to assign one. - $owner = null; // if MDATA_OWNER_ID is not set then we default to the // first admin user we find if (!array_key_exists('MDATA_OWNER_ID', $p_md)) { - $admins = Application_Model_User::getUsers(array('A')); + //$admins = Application_Model_User::getUsers(array('A')); + $admins = Application_Model_User::getUsersOfType('A'); + //$admins = array(); if (count($admins) > 0) { // found admin => pick first one $owner = $admins[0]; } @@ -166,13 +167,16 @@ class Application_Model_StoredFile } } if ($owner) { - Logging::info("Suppose to to set owner as ". - var_export($owner,true)); - $this->_file->setFkOwner($owner); + $this->_file->setDbOwnerId( $owner->getDbId() ); + } + else { + Logging::info("Could not find suitable owner for file + '".$p_md['MDATA_KEY_FILEPATH']."'"); } } foreach ($p_md as $dbColumn => $mdValue) { - //don't blank out name, defaults to original filename on first insertion to database. + // don't blank out name, defaults to original filename on first + // insertion to database. if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) { continue; } From dc8e3da6db030440b7d080e220d460058443db22 Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 24 Aug 2012 12:40:30 -0400 Subject: [PATCH 23/23] CC-4283: Password Reset: Please let user input username they want to reset -done --- .../application/controllers/LoginController.php | 13 ++++++++++--- airtime_mvc/application/forms/PasswordRestore.php | 11 +++++++++++ airtime_mvc/application/models/Auth.php | 3 ++- .../views/scripts/form/password-restore.phtml | 14 +++++++++++--- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index ca0076e52..a47a5c420 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -110,9 +110,16 @@ class LoginController extends Zend_Controller_Action $request = $this->getRequest(); if ($request->isPost() && $form->isValid($request->getPost())) { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->findOne(); + if (is_null($form->username->getValue()) || $form->username->getValue() == '') { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->findOne(); + } else { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->filterByDbLogin($form->username->getValue()) + ->findOne(); + } if (!empty($user)) { $auth = new Application_Model_Auth(); diff --git a/airtime_mvc/application/forms/PasswordRestore.php b/airtime_mvc/application/forms/PasswordRestore.php index 80e3ac1f1..eaa42ba1f 100644 --- a/airtime_mvc/application/forms/PasswordRestore.php +++ b/airtime_mvc/application/forms/PasswordRestore.php @@ -20,6 +20,17 @@ class Application_Form_PasswordRestore extends Zend_Form 'ViewHelper' ) )); + + $this->addElement('text', 'username', array( + 'label' => 'Username', + 'required' => false, + 'filters' => array( + 'stringTrim', + ), + 'decorators' => array( + 'ViewHelper' + ) + )); $this->addElement('submit', 'submit', array( 'label' => 'Restore password', diff --git a/airtime_mvc/application/models/Auth.php b/airtime_mvc/application/models/Auth.php index c287a0335..2aef1ce81 100644 --- a/airtime_mvc/application/models/Auth.php +++ b/airtime_mvc/application/models/Auth.php @@ -30,7 +30,8 @@ class Application_Model_Auth $e_link_port = $_SERVER['SERVER_PORT']; $e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change'); - $message = "Click this link: {$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}"; + $message = "Hi {$user->getDbLogin()}, \n\nClick this link to reset your password: "; + $message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}"; $success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail()); diff --git a/airtime_mvc/application/views/scripts/form/password-restore.phtml b/airtime_mvc/application/views/scripts/form/password-restore.phtml index a617ec971..a43b9fe36 100644 --- a/airtime_mvc/application/views/scripts/form/password-restore.phtml +++ b/airtime_mvc/application/views/scripts/form/password-restore.phtml @@ -1,11 +1,20 @@
-
+
+ element->getElement('username') ?> +
+ +
+ +
+
element->getElement('email') ?>
element->getElement('email')->hasErrors()): ?> @@ -15,7 +24,6 @@ -