Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 27th, 2010  |  syntax: PHP  |  size: 3.23 KB  |  hits: 107  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. abstract class Model_Base_Show extends Model_Base
  3. {
  4.     public function setTableDefinition()
  5.     {
  6.         $this->setTableName('shows');
  7.         $this->hasColumn('id_show as idShow', 'integer', 4, array(
  8.              'type' => 'integer',
  9.              'fixed' => 0,
  10.              'unsigned' => false,
  11.              'primary' => true,
  12.              'autoincrement' => true,
  13.              'length' => '4',
  14.              ));
  15.  
  16.         $this->hasColumn('type', 'string', 10, array(
  17.              'type' => 'string',
  18.              'fixed' => 0,
  19.              'unsigned' => false,
  20.              'primary' => false,
  21.              'notnull' => true,
  22.              'autoincrement' => false,
  23.              'length' => '10',
  24.              ));
  25.              
  26.         $this->setSubClasses(array(
  27.              'Model_Playlist' =>
  28.              array(
  29.               'type' => 'Playlist',
  30.              ),
  31.              'Model_Video' =>
  32.              array(
  33.               'type' => 'Video',
  34.              ),
  35.              'Model_Program' =>
  36.              array(
  37.               'type' => 'Program',
  38.              )
  39.              ));
  40.     }
  41.  
  42.     public function setUp()
  43.     {
  44.         $this->hasMany('Model_Tag as tags', array(
  45.              'refClass' => 'Model_CompoShowTag',
  46.              'local' => 'id_show',
  47.              'foreign' => 'id_tag'));
  48.     }
  49. }
  50.  
  51. abstract class Model_Base_ShowContainer extends Model_Show
  52. {
  53.     public function setUp ()
  54.     {
  55.         parent::setUp ();
  56.         $this->hasMany('Model_Video as children', array(
  57.              'local' => 'id_show_parent',
  58.              'foreign' => 'id_show_child',
  59.              'refClass' => 'Model_CompoShowShow'));
  60.     }
  61. }
  62.  
  63. abstract class Model_Base_Program extends Model_ShowContainer
  64. {
  65.  
  66. }
  67.  
  68. abstract class Model_Base_Playlist extends Model_ShowContainer
  69. {
  70.  
  71. }
  72.  
  73. abstract class Model_Base_Video extends Model_Show
  74. {
  75.  
  76. }
  77.  
  78. abstract class Model_Base_CompoShowShow extends Model_Base
  79. {
  80.     public function setTableDefinition()
  81.     {
  82.         $this->setTableName('compo_show_show');
  83.         $this->hasColumn('id_show_parent as idShowParent', 'integer', 4, array(
  84.              'type' => 'integer',
  85.              'fixed' => 0,
  86.              'unsigned' => false,
  87.              'primary' => true,
  88.              'autoincrement' => false,
  89.              'length' => '4',
  90.              ));
  91.         $this->hasColumn('id_show_child as idShowChild', 'integer', 4, array(
  92.              'type' => 'integer',
  93.              'fixed' => 0,
  94.              'unsigned' => false,
  95.              'primary' => true,
  96.              'autoincrement' => false,
  97.              'length' => '4',
  98.              ));
  99.         $this->hasColumn('index', 'integer', 4, array(
  100.              'type' => 'integer',
  101.              'fixed' => 0,
  102.              'unsigned' => false,
  103.              'primary' => false,
  104.              'notnull' => true,
  105.              'autoincrement' => false,
  106.              'length' => '4',
  107.              ));
  108.     }
  109.  
  110.     public function setUp()
  111.     {
  112.         $this->hasOne('Model_Show as parent', array(
  113.              'local' => 'id_show_parent',
  114.              'foreign' => 'id_show'));
  115.  
  116.         $this->hasOne('Model_Show as child', array(
  117.              'local' => 'id_show_child',
  118.              'foreign' => 'id_show'));
  119.     }
  120. }