Ignore:
Timestamp:
Dec 30, 2020, 11:52:07 PM (4 years ago)
Author:
chronos
Message:
  • Added: More modules models installation.
File:
1 edited

Legend:

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

    r890 r891  
    191191  }
    192192
     193  static function GetModels(): array
     194  {
     195    return array(
     196      'Member',
     197      'MemberPayment',
     198      'SupportActivity',
     199      'ServiceCategory',
     200      'Service',
     201      'ServiceCustomerRel',
     202    );
     203  }
     204
    193205  function DoInstall(): void
    194206  {
    195     $this->InstallModel(Member::GetDesc());
    196     $this->InstallModel(MemberPayment::GetDesc());
    197     $this->InstallModel(SupportActivity::GetDesc());
    198     $this->InstallModel(ServiceCategory::GetDesc());
    199     $this->InstallModel(Service::GetDesc());
    200     $this->InstallModel(ServiceCustomerRel::GetDesc());
     207    foreach (self::GetModels() as $Model)
     208    {
     209      $this->InstallModel($Model::GetDesc());
     210    }
    201211  }
    202212
    203213  function Uninstall(): void
    204214  {
    205     $this->UninstallModel(ServiceCustomerRel::GetDesc());
    206     $this->UninstallModel(Service::GetDesc());
    207     $this->UninstallModel(ServiceCategory::GetDesc());
    208     $this->UninstallModel(SupportActivity::GetDesc());
    209     $this->UninstallModel(MemberPayment::GetDesc());
    210     $this->UninstallModel(Member::GetDesc());
     215    foreach (array_reverse(self::GetModels()) as $Model)
     216    {
     217      $this->UninstallModel($Model::GetDesc());
     218    }
    211219  }
    212220
Note: See TracChangeset for help on using the changeset viewer.