From 0a0a1e9aaef629b108f26bf18c0f5f13bb0c59f0 Mon Sep 17 00:00:00 2001 From: Ollama Date: Thu, 16 Apr 2026 19:37:52 +0000 Subject: [PATCH] fix: Remove type declarations from model properties and fix primaryKey bug - Remove PHP type declarations from model property overrides to prevent fatal errors (CI4 Model declares without types) - Fix wrong $primaryKey in Tax_jurisdiction (was 'cashup_id', now 'jurisdiction_id') - Fix wrong $table in Customer_rewards (was 'customer_packages', now 'customers_packets') Addresses CodeRabbit review comments --- app/Models/Appconfig.php | 10 +++++----- app/Models/Attribute.php | 10 +++++----- app/Models/Cashup.php | 10 +++++----- app/Models/Customer.php | 10 +++++----- app/Models/Customer_rewards.php | 10 +++++----- app/Models/Dinner_table.php | 10 +++++----- app/Models/Employee.php | 10 +++++----- app/Models/Expense.php | 10 +++++----- app/Models/Expense_category.php | 10 +++++----- app/Models/Giftcard.php | 10 +++++----- app/Models/Inventory.php | 10 +++++----- app/Models/Item.php | 10 +++++----- app/Models/Item_kit.php | 10 +++++----- app/Models/Item_kit_items.php | 10 +++++----- app/Models/Item_quantity.php | 10 +++++----- app/Models/Item_taxes.php | 10 +++++----- app/Models/Module.php | 10 +++++----- app/Models/Person.php | 10 +++++----- app/Models/Receiving.php | 10 +++++----- app/Models/Rewards.php | 10 +++++----- app/Models/Sale.php | 10 +++++----- app/Models/Stock_location.php | 10 +++++----- app/Models/Supplier.php | 10 +++++----- app/Models/Tax.php | 10 +++++----- app/Models/Tax_category.php | 10 +++++----- app/Models/Tax_code.php | 10 +++++----- app/Models/Tax_jurisdiction.php | 10 +++++----- app/Models/Tokens/Token.php | 2 +- 28 files changed, 136 insertions(+), 136 deletions(-) diff --git a/app/Models/Appconfig.php b/app/Models/Appconfig.php index eed30f977..465e53c46 100644 --- a/app/Models/Appconfig.php +++ b/app/Models/Appconfig.php @@ -8,11 +8,11 @@ use ReflectionException; class Appconfig extends BaseModel { - protected string $table = 'app_config'; - protected string $primaryKey = 'key'; - protected bool $useAutoIncrement = false; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'app_config'; + protected $primaryKey = 'key'; + protected $useAutoIncrement = false; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'key', 'value' ]; diff --git a/app/Models/Attribute.php b/app/Models/Attribute.php index 8ca340ebd..47bc596d0 100644 --- a/app/Models/Attribute.php +++ b/app/Models/Attribute.php @@ -14,11 +14,11 @@ use ReflectionClass; class Attribute extends BaseModel { - protected string $table = 'attribute_definitions'; - protected string $primaryKey = 'definition_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'attribute_definitions'; + protected $primaryKey = 'definition_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'definition_name', 'definition_type', 'definition_unit', diff --git a/app/Models/Cashup.php b/app/Models/Cashup.php index b937f9911..79b11411b 100644 --- a/app/Models/Cashup.php +++ b/app/Models/Cashup.php @@ -8,11 +8,11 @@ use stdClass; class Cashup extends BaseModel { - protected string $table = 'cash_up'; - protected string $primaryKey = 'cashup_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'cash_up'; + protected $primaryKey = 'cashup_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'open_date', 'close_date', 'open_cash_amount', diff --git a/app/Models/Customer.php b/app/Models/Customer.php index d3d264490..57bc4e7bd 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -8,11 +8,11 @@ use stdClass; class Customer extends Person { - protected string $table = 'customers'; - protected string $primaryKey = 'person_id'; - protected bool $useAutoIncrement = false; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'customers'; + protected $primaryKey = 'person_id'; + protected $useAutoIncrement = false; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'account_number', 'taxable', 'tax_id', diff --git a/app/Models/Customer_rewards.php b/app/Models/Customer_rewards.php index 319403a4c..4a9c80fe1 100644 --- a/app/Models/Customer_rewards.php +++ b/app/Models/Customer_rewards.php @@ -6,11 +6,11 @@ use CodeIgniter\Database\ResultInterface; class Customer_rewards extends BaseModel { - protected string $table = 'customer_packages'; - protected string $primaryKey = 'package_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'customers_packages'; + protected $primaryKey = 'package_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'package_name', 'points_percent', 'deleted' diff --git a/app/Models/Dinner_table.php b/app/Models/Dinner_table.php index 236f3267d..9e66fda77 100644 --- a/app/Models/Dinner_table.php +++ b/app/Models/Dinner_table.php @@ -6,11 +6,11 @@ use CodeIgniter\Database\ResultInterface; class Dinner_table extends BaseModel { - protected string $table = 'dinner_tables'; - protected string $primaryKey = 'dinner_table_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'dinner_tables'; + protected $primaryKey = 'dinner_table_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'name', 'status', 'deleted' diff --git a/app/Models/Employee.php b/app/Models/Employee.php index b4e46bc5a..595eb2678 100644 --- a/app/Models/Employee.php +++ b/app/Models/Employee.php @@ -9,11 +9,11 @@ use stdClass; class Employee extends Person { public Session $session; - protected string $table = 'Employees'; - protected string $primaryKey = 'person_id'; - protected bool $useAutoIncrement = false; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'Employees'; + protected $primaryKey = 'person_id'; + protected $useAutoIncrement = false; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'username', 'password', 'deleted', diff --git a/app/Models/Expense.php b/app/Models/Expense.php index e5282c087..327589425 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -8,11 +8,11 @@ use stdClass; class Expense extends BaseModel { - protected string $table = 'expenses'; - protected string $primaryKey = 'expense_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'expenses'; + protected $primaryKey = 'expense_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'date', 'amount', 'payment_type', diff --git a/app/Models/Expense_category.php b/app/Models/Expense_category.php index 3c2c67a1a..cf05267d3 100644 --- a/app/Models/Expense_category.php +++ b/app/Models/Expense_category.php @@ -7,11 +7,11 @@ use stdClass; class Expense_category extends BaseModel { - protected string $table = 'expense_categories'; - protected string $primaryKey = 'expense_category_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'expense_categories'; + protected $primaryKey = 'expense_category_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'category_name', 'category_description', 'deleted' diff --git a/app/Models/Giftcard.php b/app/Models/Giftcard.php index 94dd134d5..3ce362dbb 100644 --- a/app/Models/Giftcard.php +++ b/app/Models/Giftcard.php @@ -7,11 +7,11 @@ use stdClass; class Giftcard extends BaseModel { - protected string $table = 'giftcards'; - protected string $primaryKey = 'giftcard_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'giftcards'; + protected $primaryKey = 'giftcard_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'giftcard_number', 'value', 'deleted', diff --git a/app/Models/Inventory.php b/app/Models/Inventory.php index ffa814ed1..ce72b50f1 100644 --- a/app/Models/Inventory.php +++ b/app/Models/Inventory.php @@ -6,11 +6,11 @@ use CodeIgniter\Database\ResultInterface; class Inventory extends BaseModel { - protected string $table = 'inventory'; - protected string $primaryKey = 'trans_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'inventory'; + protected $primaryKey = 'trans_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'trans_items', 'trans_user', 'trans_date', diff --git a/app/Models/Item.php b/app/Models/Item.php index 7fb267a78..029958b7c 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -24,11 +24,11 @@ class Item extends BaseModel 'allow_alt_description', 'is_serialized' ]; - protected string $table = 'items'; - protected string $primaryKey = 'item_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'items'; + protected $primaryKey = 'item_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'name', 'category', 'supplier_id', diff --git a/app/Models/Item_kit.php b/app/Models/Item_kit.php index 70fc8f28d..7dd005db5 100644 --- a/app/Models/Item_kit.php +++ b/app/Models/Item_kit.php @@ -8,11 +8,11 @@ use stdClass; class Item_kit extends BaseModel { - protected string $table = 'item_kits'; - protected string $primaryKey = 'item_kit_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'item_kits'; + protected $primaryKey = 'item_kit_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'item_kit_number', 'name', 'description', diff --git a/app/Models/Item_kit_items.php b/app/Models/Item_kit_items.php index a2e045741..c754ba5f6 100644 --- a/app/Models/Item_kit_items.php +++ b/app/Models/Item_kit_items.php @@ -4,11 +4,11 @@ namespace App\Models; class Item_kit_items extends BaseModel { - protected string $table = 'item_kit_items'; - protected string $primaryKey = 'item_kit_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'item_kit_items'; + protected $primaryKey = 'item_kit_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'kit_sequence' ]; diff --git a/app/Models/Item_quantity.php b/app/Models/Item_quantity.php index 39cec5e51..8e096c284 100644 --- a/app/Models/Item_quantity.php +++ b/app/Models/Item_quantity.php @@ -6,11 +6,11 @@ use stdClass; class Item_quantity extends BaseModel { - protected string $table = 'item_quantities'; - protected string $primaryKey = 'item_id'; - protected bool $useAutoIncrement = false; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'item_quantities'; + protected $primaryKey = 'item_id'; + protected $useAutoIncrement = false; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'quantity' ]; diff --git a/app/Models/Item_taxes.php b/app/Models/Item_taxes.php index 8e04517a8..aa1566f76 100644 --- a/app/Models/Item_taxes.php +++ b/app/Models/Item_taxes.php @@ -4,11 +4,11 @@ namespace App\Models; class Item_taxes extends BaseModel { - protected string $table = 'item_taxes'; - protected string $primaryKey = 'item_id'; - protected bool $useAutoIncrement = false; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'item_taxes'; + protected $primaryKey = 'item_id'; + protected $useAutoIncrement = false; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'name', 'percent' ]; diff --git a/app/Models/Module.php b/app/Models/Module.php index 9d3ced137..2209c8a93 100644 --- a/app/Models/Module.php +++ b/app/Models/Module.php @@ -6,11 +6,11 @@ use CodeIgniter\Database\ResultInterface; class Module extends BaseModel { - protected string $table = 'modules'; - protected string $primaryKey = 'module_id'; - protected bool $useAutoIncrement = false; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'modules'; + protected $primaryKey = 'module_id'; + protected $useAutoIncrement = false; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'name_lang_key', 'desc_lang_key', 'sort' diff --git a/app/Models/Person.php b/app/Models/Person.php index bb65e0260..79691543d 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -7,11 +7,11 @@ use stdClass; class Person extends BaseModel { - protected string $table = 'people'; - protected string $primaryKey = 'person_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'people'; + protected $primaryKey = 'person_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'first_name', 'last_name', 'phone_number', diff --git a/app/Models/Receiving.php b/app/Models/Receiving.php index 9eae14383..0ec8a7326 100644 --- a/app/Models/Receiving.php +++ b/app/Models/Receiving.php @@ -8,11 +8,11 @@ use ReflectionException; class Receiving extends BaseModel { - protected string $table = 'receivings'; - protected string $primaryKey = 'receiving_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'receivings'; + protected $primaryKey = 'receiving_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'receiving_time', 'supplier_id', 'employee_id', diff --git a/app/Models/Rewards.php b/app/Models/Rewards.php index 2828e9fa2..b6034bd26 100644 --- a/app/Models/Rewards.php +++ b/app/Models/Rewards.php @@ -4,11 +4,11 @@ namespace App\Models; class Rewards extends BaseModel { - protected string $table = 'sales_reward_points'; - protected string $primaryKey = 'id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'sales_reward_points'; + protected $primaryKey = 'id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'sale_id', 'earned', 'used' diff --git a/app/Models/Sale.php b/app/Models/Sale.php index 89d5ceebb..489e3bf94 100644 --- a/app/Models/Sale.php +++ b/app/Models/Sale.php @@ -10,11 +10,11 @@ use ReflectionException; class Sale extends BaseModel { - protected string $table = 'sales'; - protected string $primaryKey = 'sale_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'sales'; + protected $primaryKey = 'sale_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'sale_time', 'customer_id', 'employee_id', diff --git a/app/Models/Stock_location.php b/app/Models/Stock_location.php index e0400c1a8..ad5262773 100644 --- a/app/Models/Stock_location.php +++ b/app/Models/Stock_location.php @@ -7,11 +7,11 @@ use CodeIgniter\Session\Session; class Stock_location extends BaseModel { - protected string $table = 'stock_locations'; - protected string $primaryKey = 'location_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'stock_locations'; + protected $primaryKey = 'location_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'location_name', 'deleted' ]; diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index 1a0f4b72c..4f88e6202 100644 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -6,11 +6,11 @@ use CodeIgniter\Database\ResultInterface; class Supplier extends Person { - protected string $table = 'suppliers'; - protected string $primaryKey = 'person_id'; - protected bool $useAutoIncrement = false; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'suppliers'; + protected $primaryKey = 'person_id'; + protected $useAutoIncrement = false; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'company_name', 'account_number', 'tax_id', diff --git a/app/Models/Tax.php b/app/Models/Tax.php index 1e0c2ba3e..9a15df1ec 100644 --- a/app/Models/Tax.php +++ b/app/Models/Tax.php @@ -7,11 +7,11 @@ use stdClass; class Tax extends BaseModel { - protected string $table = 'tax_rates'; - protected string $primaryKey = 'tax_rate_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'tax_rates'; + protected $primaryKey = 'tax_rate_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'rate_tax_code_id', 'rate_tax_category_id', 'rate_jurisdiction_id', diff --git a/app/Models/Tax_category.php b/app/Models/Tax_category.php index 4157605f0..aa4ef443a 100644 --- a/app/Models/Tax_category.php +++ b/app/Models/Tax_category.php @@ -7,11 +7,11 @@ use stdClass; class Tax_category extends BaseModel { - protected string $table = 'tax_categories'; - protected string $primaryKey = 'tax_category_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'tax_categories'; + protected $primaryKey = 'tax_category_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'tax_category', 'tax_group_sequence', 'deleted' diff --git a/app/Models/Tax_code.php b/app/Models/Tax_code.php index dd3f1202f..024147497 100644 --- a/app/Models/Tax_code.php +++ b/app/Models/Tax_code.php @@ -8,11 +8,11 @@ use stdClass; class Tax_code extends BaseModel { - protected string $table = 'tax_codes'; - protected string $primaryKey = 'tax_code_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'tax_codes'; + protected $primaryKey = 'tax_code_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'tax_code', 'tax_code_name', 'city', diff --git a/app/Models/Tax_jurisdiction.php b/app/Models/Tax_jurisdiction.php index 0d0c1b822..49feb02ad 100644 --- a/app/Models/Tax_jurisdiction.php +++ b/app/Models/Tax_jurisdiction.php @@ -7,11 +7,11 @@ use stdClass; class Tax_jurisdiction extends BaseModel { - protected string $table = 'tax_jurisdictions'; - protected string $primaryKey = 'cashup_id'; - protected bool $useAutoIncrement = true; - protected bool $useSoftDeletes = false; - protected array $allowedFields = [ + protected $table = 'tax_jurisdictions'; + protected $primaryKey = 'jurisdiction_id'; + protected $useAutoIncrement = true; + protected $useSoftDeletes = false; + protected $allowedFields = [ 'jurisdiction_name', 'tax_group', 'tax_type', diff --git a/app/Models/Tokens/Token.php b/app/Models/Tokens/Token.php index 63b8927c1..2012949cd 100644 --- a/app/Models/Tokens/Token.php +++ b/app/Models/Tokens/Token.php @@ -9,7 +9,7 @@ use CodeIgniter\Model; */ abstract class Token extends Model { - protected string $value = ''; + protected $value = ''; /** * @param string $value