Ignore:
Timestamp:
Jan 5, 2021, 10:30:31 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Further improved models initialization system.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/News/News.php

    r893 r894  
    3030  function GetModels(): array
    3131  {
    32     return array('NewsCategory', 'News');
    33   }
    34 
    35   function DoInstall(): void
    36   {
    37     foreach (self::GetModels() as $Model)
    38     {
    39       $this->InstallModel($Model::GetDesc());
    40     }
    41   }
    42 
    43   function DoUnInstall(): void
    44   {
    45     foreach (array_reverse(self::GetModels()) as $Model)
    46     {
    47       $this->UninstallModel($Model::GetDesc());
    48     }
     32    return array(NewsCategory::GetClassName(), News::GetClassName());
    4933  }
    5034
     
    302286  static function GetDesc(): ModelDesc
    303287  {
    304     $Desc = new ModelDesc('News');
    305     $Desc->AddReference('Category', 'NewsCategory', true);
     288    $Desc = new ModelDesc(self::GetClassName());
     289    $Desc->AddReference('Category', NewsCategory::GetClassName(), true);
    306290    $Desc->AddString('Title');
    307291    $Desc->AddText('Content');
     
    309293    $Desc->AddString('Author');
    310294    $Desc->AddString('Enclosure');
    311     $Desc->AddReference('User', 'User');
     295    $Desc->AddReference('User', User::GetClassName());
    312296    $Desc->AddString('IP');
    313297    $Desc->AddString('Link');
     
    320304  static function GetDesc(): ModelDesc
    321305  {
    322     $Desc = new ModelDesc('NewsCategory');
     306    $Desc = new ModelDesc(self::GetClassName());
    323307    $Desc->AddString('Caption');
    324308    $Desc->AddString('RSS');
Note: See TracChangeset for help on using the changeset viewer.