Changeset 894 for trunk/Packages/Common


Ignore:
Timestamp:
Jan 5, 2021, 10:30:31 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Further improved models initialization system.
Location:
trunk/Packages/Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/AppModule.php

    r893 r894  
    223223      else if ($Column->Type == ModelColumnType::Boolean) $Query .= 'tinyint(1)';
    224224      else if ($Column->Type == ModelColumnType::Date) $Query .= 'date';
     225      else if ($Column->Type == ModelColumnType::BigInt) $Query .= 'bigint(20)';
    225226      else if ($Column->Type == ModelColumnType::Enum)
    226227      {
  • trunk/Packages/Common/Base.php

    r891 r894  
    2020    $this->System = &$System;
    2121    $this->Database = &$System->Database;
     22  }
     23
     24  static function GetClassName()
     25  {
     26    return get_called_class();
    2227  }
    2328}
     
    7681  {
    7782    $Result = new ModelColumnInteger($Name);
     83    $this->Columns[] = $Result;
     84    return $Result;
     85  }
     86
     87  function AddBigInt(string $Name): ModelColumnBigInt
     88  {
     89    $Result = new ModelColumnBigInt($Name);
    7890    $this->Columns[] = $Result;
    7991    return $Result;
     
    137149  const Date = 7;
    138150  const Enum = 8;
     151  const BigInt = 9;
    139152}
    140153
     
    230243}
    231244
     245class ModelColumnBigInt extends ModelColumn
     246{
     247  public ?int $Default;
     248
     249  function __construct(string $Name)
     250  {
     251    parent::__construct($Name, ModelColumnType::BigInt);
     252    $this->HasDefault = false;
     253    $this->Default = null;
     254  }
     255
     256  function GetDefault(): ?string
     257  {
     258    return $this->Default;
     259  }
     260}
     261
    232262class ModelColumnDateTime extends ModelColumn
    233263{
Note: See TracChangeset for help on using the changeset viewer.