
Untitled
By: a guest on
Apr 27th, 2010 | syntax:
PHP | size: 3.23 KB | hits: 107 | expires: Never
<?php
abstract class Model_Base_Show extends Model_Base
{
public function setTableDefinition()
{
$this->setTableName('shows');
$this->hasColumn('id_show as idShow', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => true,
'autoincrement' => true,
'length' => '4',
));
$this->hasColumn('type', 'string', 10, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '10',
));
$this->setSubClasses(array(
'Model_Playlist' =>
array(
'type' => 'Playlist',
),
'Model_Video' =>
array(
'type' => 'Video',
),
'Model_Program' =>
array(
'type' => 'Program',
)
));
}
public function setUp()
{
$this->hasMany('Model_Tag as tags', array(
'refClass' => 'Model_CompoShowTag',
'local' => 'id_show',
'foreign' => 'id_tag'));
}
}
abstract class Model_Base_ShowContainer extends Model_Show
{
public function setUp ()
{
parent::setUp ();
$this->hasMany('Model_Video as children', array(
'local' => 'id_show_parent',
'foreign' => 'id_show_child',
'refClass' => 'Model_CompoShowShow'));
}
}
abstract class Model_Base_Program extends Model_ShowContainer
{
}
abstract class Model_Base_Playlist extends Model_ShowContainer
{
}
abstract class Model_Base_Video extends Model_Show
{
}
abstract class Model_Base_CompoShowShow extends Model_Base
{
public function setTableDefinition()
{
$this->setTableName('compo_show_show');
$this->hasColumn('id_show_parent as idShowParent', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => true,
'autoincrement' => false,
'length' => '4',
));
$this->hasColumn('id_show_child as idShowChild', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => true,
'autoincrement' => false,
'length' => '4',
));
$this->hasColumn('index', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '4',
));
}
public function setUp()
{
$this->hasOne('Model_Show as parent', array(
'local' => 'id_show_parent',
'foreign' => 'id_show'));
$this->hasOne('Model_Show as child', array(
'local' => 'id_show_child',
'foreign' => 'id_show'));
}
}