CC-5896: Store cloud files in separate table, inherited from cc_files

Using Class Table Inheritance - delegate behaviour, created a cloud_file
table to store cloud files
This commit is contained in:
drigato 2014-07-23 15:22:42 -04:00
parent 9c2a086487
commit 41ff0cce67
14 changed files with 2999 additions and 113 deletions

View file

@ -109,7 +109,6 @@ class CcFilesTableMap extends TableMap
$this->addColumn('hidden', 'DbHidden', 'BOOLEAN', false, null, false);
$this->addColumn('is_scheduled', 'DbIsScheduled', 'BOOLEAN', false, null, false);
$this->addColumn('is_playlist', 'DbIsPlaylist', 'BOOLEAN', false, null, false);
$this->addColumn('resource_id', 'DbResourceId', 'LONGVARCHAR', false, null, null);
// validators
} // initialize()
@ -121,6 +120,7 @@ class CcFilesTableMap extends TableMap
$this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null);
$this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null);
$this->addRelation('CloudFile', 'CloudFile', RelationMap::ONE_TO_MANY, array('id' => 'cc_file_id', ), null, null, 'CloudFiles');
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcShowInstancess');
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcBlockcontentss');

View file

@ -0,0 +1,71 @@
<?php
/**
* This class defines the structure of the 'cloud_file' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CloudFileTableMap extends TableMap
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CloudFileTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cloud_file');
$this->setPhpName('CloudFile');
$this->setClassname('CloudFile');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cloud_file_id_seq');
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addColumn('resource_id', 'ResourceId', 'LONGVARCHAR', true, null, null);
$this->addForeignKey('cc_file_id', 'CcFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('cc_file_id' => 'id', ), null, null);
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'delegate' => array (
'to' => 'cc_files',
),
);
} // getBehaviors()
} // CloudFileTableMap