85 lines
2.8 KiB
PHP
85 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace Trinity\Bundle\MediaBundle\Model\map;
|
|
|
|
use \RelationMap;
|
|
use \TableMap;
|
|
|
|
|
|
/**
|
|
* This class defines the structure of the 'media_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.vendor.trinity.src.Trinity.Bundle.MediaBundle.Model.map
|
|
*/
|
|
class MediaTableMap extends TableMap
|
|
{
|
|
|
|
/**
|
|
* The (dot-path) name of this class
|
|
*/
|
|
const CLASS_NAME = 'vendor.trinity.src.Trinity.Bundle.MediaBundle.Model.map.MediaTableMap';
|
|
|
|
/**
|
|
* 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('media_file');
|
|
$this->setPhpName('Media');
|
|
$this->setClassname('Trinity\\Bundle\\MediaBundle\\Model\\Media');
|
|
$this->setPackage('vendor.trinity.src.Trinity.Bundle.MediaBundle.Model');
|
|
$this->setUseIdGenerator(true);
|
|
// columns
|
|
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
|
|
$this->addForeignKey('type_id', 'TypeId', 'INTEGER', 'media_type', 'id', false, null, null);
|
|
$this->addForeignKey('category_id', 'CategoryId', 'INTEGER', 'media_category', 'id', false, null, null);
|
|
$this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
|
$this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
|
$this->addColumn('file', 'File', 'VARCHAR', false, 255, null);
|
|
// validators
|
|
} // initialize()
|
|
|
|
/**
|
|
* Build the RelationMap objects for this table relationships
|
|
*/
|
|
public function buildRelations()
|
|
{
|
|
$this->addRelation('Type', 'Trinity\\Bundle\\MediaBundle\\Model\\Type', RelationMap::MANY_TO_ONE, array('type_id' => 'id', ), 'SET NULL', 'SET NULL');
|
|
$this->addRelation('Category', 'Trinity\\Bundle\\MediaBundle\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_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(
|
|
'timestampable' => array (
|
|
'create_column' => 'created_at',
|
|
'update_column' => 'updated_at',
|
|
'disable_updated_at' => 'false',
|
|
),
|
|
'uploadable' => array (
|
|
'fields' => 'file',
|
|
'paths' => 'uploads/media/file',
|
|
),
|
|
);
|
|
} // getBehaviors()
|
|
|
|
} // MediaTableMap
|