diff --git a/airtime_mvc/application/models/airtime/map/CloudFileTableMap.php b/airtime_mvc/application/models/airtime/map/CloudFileTableMap.php
index 898fc0b79..5f9702bf2 100644
--- a/airtime_mvc/application/models/airtime/map/CloudFileTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CloudFileTableMap.php
@@ -40,6 +40,7 @@ class CloudFileTableMap extends TableMap
$this->setPrimaryKeyMethodInfo('cloud_file_id_seq');
// columns
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('storage_backend', 'StorageBackend', 'VARCHAR', true, 512, null);
$this->addColumn('resource_id', 'ResourceId', 'LONGVARCHAR', true, null, null);
$this->addForeignKey('cc_file_id', 'CcFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
// validators
diff --git a/airtime_mvc/application/models/airtime/om/BaseCloudFile.php b/airtime_mvc/application/models/airtime/om/BaseCloudFile.php
index f9b2e0727..988fadeb9 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCloudFile.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCloudFile.php
@@ -35,6 +35,12 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
*/
protected $id;
+ /**
+ * The value for the storage_backend field.
+ * @var string
+ */
+ protected $storage_backend;
+
/**
* The value for the resource_id field.
* @var string
@@ -83,6 +89,17 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
return $this->id;
}
+ /**
+ * Get the [storage_backend] column value.
+ *
+ * @return string
+ */
+ public function getStorageBackend()
+ {
+
+ return $this->storage_backend;
+ }
+
/**
* Get the [resource_id] column value.
*
@@ -126,6 +143,27 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
return $this;
} // setDbId()
+ /**
+ * Set the value of [storage_backend] column.
+ *
+ * @param string $v new value
+ * @return CloudFile The current object (for fluent API support)
+ */
+ public function setStorageBackend($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->storage_backend !== $v) {
+ $this->storage_backend = $v;
+ $this->modifiedColumns[] = CloudFilePeer::STORAGE_BACKEND;
+ }
+
+
+ return $this;
+ } // setStorageBackend()
+
/**
* Set the value of [resource_id] column.
*
@@ -205,8 +243,9 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
- $this->resource_id = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->cc_file_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
+ $this->storage_backend = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->resource_id = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->cc_file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
$this->resetModified();
$this->setNew(false);
@@ -216,7 +255,7 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
}
$this->postHydrate($row, $startcol, $rehydrate);
- return $startcol + 3; // 3 = CloudFilePeer::NUM_HYDRATE_COLUMNS.
+ return $startcol + 4; // 4 = CloudFilePeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CloudFile object", $e);
@@ -457,6 +496,9 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
if ($this->isColumnModified(CloudFilePeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
+ if ($this->isColumnModified(CloudFilePeer::STORAGE_BACKEND)) {
+ $modifiedColumns[':p' . $index++] = '"storage_backend"';
+ }
if ($this->isColumnModified(CloudFilePeer::RESOURCE_ID)) {
$modifiedColumns[':p' . $index++] = '"resource_id"';
}
@@ -477,6 +519,9 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
+ case '"storage_backend"':
+ $stmt->bindValue($identifier, $this->storage_backend, PDO::PARAM_STR);
+ break;
case '"resource_id"':
$stmt->bindValue($identifier, $this->resource_id, PDO::PARAM_STR);
break;
@@ -626,9 +671,12 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
return $this->getDbId();
break;
case 1:
- return $this->getResourceId();
+ return $this->getStorageBackend();
break;
case 2:
+ return $this->getResourceId();
+ break;
+ case 3:
return $this->getCcFileId();
break;
default:
@@ -661,8 +709,9 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
$keys = CloudFilePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
- $keys[1] => $this->getResourceId(),
- $keys[2] => $this->getCcFileId(),
+ $keys[1] => $this->getStorageBackend(),
+ $keys[2] => $this->getResourceId(),
+ $keys[3] => $this->getCcFileId(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -711,9 +760,12 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
$this->setDbId($value);
break;
case 1:
- $this->setResourceId($value);
+ $this->setStorageBackend($value);
break;
case 2:
+ $this->setResourceId($value);
+ break;
+ case 3:
$this->setCcFileId($value);
break;
} // switch()
@@ -741,8 +793,9 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
$keys = CloudFilePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setResourceId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setCcFileId($arr[$keys[2]]);
+ if (array_key_exists($keys[1], $arr)) $this->setStorageBackend($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setResourceId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setCcFileId($arr[$keys[3]]);
}
/**
@@ -755,6 +808,7 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
$criteria = new Criteria(CloudFilePeer::DATABASE_NAME);
if ($this->isColumnModified(CloudFilePeer::ID)) $criteria->add(CloudFilePeer::ID, $this->id);
+ if ($this->isColumnModified(CloudFilePeer::STORAGE_BACKEND)) $criteria->add(CloudFilePeer::STORAGE_BACKEND, $this->storage_backend);
if ($this->isColumnModified(CloudFilePeer::RESOURCE_ID)) $criteria->add(CloudFilePeer::RESOURCE_ID, $this->resource_id);
if ($this->isColumnModified(CloudFilePeer::CC_FILE_ID)) $criteria->add(CloudFilePeer::CC_FILE_ID, $this->cc_file_id);
@@ -820,6 +874,7 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
*/
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
+ $copyObj->setStorageBackend($this->getStorageBackend());
$copyObj->setResourceId($this->getResourceId());
$copyObj->setCcFileId($this->getCcFileId());
@@ -938,6 +993,7 @@ abstract class BaseCloudFile extends BaseObject implements Persistent
public function clear()
{
$this->id = null;
+ $this->storage_backend = null;
$this->resource_id = null;
$this->cc_file_id = null;
$this->alreadyInSave = false;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCloudFilePeer.php b/airtime_mvc/application/models/airtime/om/BaseCloudFilePeer.php
index 93a0f4d7b..4a1b641c1 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCloudFilePeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCloudFilePeer.php
@@ -24,17 +24,20 @@ abstract class BaseCloudFilePeer
const TM_CLASS = 'CloudFileTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 3;
+ const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
- const NUM_HYDRATE_COLUMNS = 3;
+ const NUM_HYDRATE_COLUMNS = 4;
/** the column name for the id field */
const ID = 'cloud_file.id';
+ /** the column name for the storage_backend field */
+ const STORAGE_BACKEND = 'cloud_file.storage_backend';
+
/** the column name for the resource_id field */
const RESOURCE_ID = 'cloud_file.resource_id';
@@ -60,12 +63,12 @@ abstract class BaseCloudFilePeer
* e.g. CloudFilePeer::$fieldNames[CloudFilePeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'ResourceId', 'CcFileId', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'resourceId', 'ccFileId', ),
- BasePeer::TYPE_COLNAME => array (CloudFilePeer::ID, CloudFilePeer::RESOURCE_ID, CloudFilePeer::CC_FILE_ID, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'RESOURCE_ID', 'CC_FILE_ID', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'resource_id', 'cc_file_id', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, )
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'StorageBackend', 'ResourceId', 'CcFileId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'storageBackend', 'resourceId', 'ccFileId', ),
+ BasePeer::TYPE_COLNAME => array (CloudFilePeer::ID, CloudFilePeer::STORAGE_BACKEND, CloudFilePeer::RESOURCE_ID, CloudFilePeer::CC_FILE_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STORAGE_BACKEND', 'RESOURCE_ID', 'CC_FILE_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'storage_backend', 'resource_id', 'cc_file_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
@@ -75,12 +78,12 @@ abstract class BaseCloudFilePeer
* e.g. CloudFilePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'ResourceId' => 1, 'CcFileId' => 2, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'resourceId' => 1, 'ccFileId' => 2, ),
- BasePeer::TYPE_COLNAME => array (CloudFilePeer::ID => 0, CloudFilePeer::RESOURCE_ID => 1, CloudFilePeer::CC_FILE_ID => 2, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'RESOURCE_ID' => 1, 'CC_FILE_ID' => 2, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'resource_id' => 1, 'cc_file_id' => 2, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, )
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'StorageBackend' => 1, 'ResourceId' => 2, 'CcFileId' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'storageBackend' => 1, 'resourceId' => 2, 'ccFileId' => 3, ),
+ BasePeer::TYPE_COLNAME => array (CloudFilePeer::ID => 0, CloudFilePeer::STORAGE_BACKEND => 1, CloudFilePeer::RESOURCE_ID => 2, CloudFilePeer::CC_FILE_ID => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STORAGE_BACKEND' => 1, 'RESOURCE_ID' => 2, 'CC_FILE_ID' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'storage_backend' => 1, 'resource_id' => 2, 'cc_file_id' => 3, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
@@ -155,10 +158,12 @@ abstract class BaseCloudFilePeer
{
if (null === $alias) {
$criteria->addSelectColumn(CloudFilePeer::ID);
+ $criteria->addSelectColumn(CloudFilePeer::STORAGE_BACKEND);
$criteria->addSelectColumn(CloudFilePeer::RESOURCE_ID);
$criteria->addSelectColumn(CloudFilePeer::CC_FILE_ID);
} else {
$criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.storage_backend');
$criteria->addSelectColumn($alias . '.resource_id');
$criteria->addSelectColumn($alias . '.cc_file_id');
}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCloudFileQuery.php b/airtime_mvc/application/models/airtime/om/BaseCloudFileQuery.php
index d09041387..e57ff2797 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCloudFileQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCloudFileQuery.php
@@ -7,10 +7,12 @@
*
*
* @method CloudFileQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CloudFileQuery orderByStorageBackend($order = Criteria::ASC) Order by the storage_backend column
* @method CloudFileQuery orderByResourceId($order = Criteria::ASC) Order by the resource_id column
* @method CloudFileQuery orderByCcFileId($order = Criteria::ASC) Order by the cc_file_id column
*
* @method CloudFileQuery groupByDbId() Group by the id column
+ * @method CloudFileQuery groupByStorageBackend() Group by the storage_backend column
* @method CloudFileQuery groupByResourceId() Group by the resource_id column
* @method CloudFileQuery groupByCcFileId() Group by the cc_file_id column
*
@@ -25,10 +27,12 @@
* @method CloudFile findOne(PropelPDO $con = null) Return the first CloudFile matching the query
* @method CloudFile findOneOrCreate(PropelPDO $con = null) Return the first CloudFile matching the query, or a new CloudFile object populated from the query conditions when no match is found
*
+ * @method CloudFile findOneByStorageBackend(string $storage_backend) Return the first CloudFile filtered by the storage_backend column
* @method CloudFile findOneByResourceId(string $resource_id) Return the first CloudFile filtered by the resource_id column
* @method CloudFile findOneByCcFileId(int $cc_file_id) Return the first CloudFile filtered by the cc_file_id column
*
* @method array findByDbId(int $id) Return CloudFile objects filtered by the id column
+ * @method array findByStorageBackend(string $storage_backend) Return CloudFile objects filtered by the storage_backend column
* @method array findByResourceId(string $resource_id) Return CloudFile objects filtered by the resource_id column
* @method array findByCcFileId(int $cc_file_id) Return CloudFile objects filtered by the cc_file_id column
*
@@ -138,7 +142,7 @@ abstract class BaseCloudFileQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT "id", "resource_id", "cc_file_id" FROM "cloud_file" WHERE "id" = :p0';
+ $sql = 'SELECT "id", "storage_backend", "resource_id", "cc_file_id" FROM "cloud_file" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -269,6 +273,35 @@ abstract class BaseCloudFileQuery extends ModelCriteria
return $this->addUsingAlias(CloudFilePeer::ID, $dbId, $comparison);
}
+ /**
+ * Filter the query on the storage_backend column
+ *
+ * Example usage:
+ *
+ * $query->filterByStorageBackend('fooValue'); // WHERE storage_backend = 'fooValue'
+ * $query->filterByStorageBackend('%fooValue%'); // WHERE storage_backend LIKE '%fooValue%'
+ *
+ *
+ * @param string $storageBackend The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CloudFileQuery The current query, for fluid interface
+ */
+ public function filterByStorageBackend($storageBackend = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($storageBackend)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $storageBackend)) {
+ $storageBackend = str_replace('*', '%', $storageBackend);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CloudFilePeer::STORAGE_BACKEND, $storageBackend, $comparison);
+ }
+
/**
* Filter the query on the resource_id column
*
diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php
index 43550cdde..6563e857a 100644
--- a/airtime_mvc/application/modules/rest/controllers/MediaController.php
+++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php
@@ -180,7 +180,7 @@ class Rest_MediaController extends Zend_Rest_Controller
$file = CcFilesQuery::create()->findPk($id);
// Since we check for this value when deleting files, set it first
- $file->setDbDirectory(self::MUSIC_DIRS_STOR_PK);
+ //$file->setDbDirectory(self::MUSIC_DIRS_STOR_PK);
$requestData = json_decode($this->getRequest()->getRawBody(), true);
$whiteList = $this->removeBlacklistedFieldsFromRequestData($requestData);
@@ -203,6 +203,7 @@ class Rest_MediaController extends Zend_Rest_Controller
return;
}
$cloudFile = new CloudFile();
+ $cloudFile->setStorageBackend($requestData["storage_backend"]);
$cloudFile->setResourceId($requestData["resource_id"]);
$cloudFile->setCcFiles($file);
$cloudFile->save();
diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml
index ff76e268e..d8cabfeb1 100644
--- a/airtime_mvc/build/schema.xml
+++ b/airtime_mvc/build/schema.xml
@@ -101,6 +101,7 @@