refactor: Add getters for protected model properties

- Create BaseModel with getters for $table, $primaryKey, $allowedFields
- All models now extend BaseModel instead of CodeIgniter\Model
- Add type declarations to protected properties

Closes #4489
This commit is contained in:
Ollama
2026-04-15 12:40:24 +00:00
parent 905b58ca6e
commit e17e85bc4c
29 changed files with 194 additions and 304 deletions

33
app/Models/BaseModel.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
abstract class BaseModel extends Model
{
public function getTableName(): string
{
return $this->table;
}
public function getPrimaryKeyName(): string
{
return $this->primaryKey;
}
public function getAllowedFields(): array
{
return $this->allowedFields;
}
public function getUseAutoIncrement(): bool
{
return $this->useAutoIncrement;
}
public function getUseSoftDeletes(): bool
{
return $this->useSoftDeletes;
}
}