mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-12 14:53:20 -04:00
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:
1 parent
905b58ca6e
commit
e17e85bc4c
29 files changed
+194
-304
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user