Refactor database object trait and improve data handling

Added `delete`, `restore`, and other utility methods to enhance CRUD operations, including support for soft deletes. Introduced `objectChanged` hooks across objects for better cache or event handling, ensuring scalability and maintainability. Refactored and standardized object property handling while restructuring related methods.
This commit is contained in:
Jepp9350
2025-02-12 09:23:35 +01:00
parent 555d4e9918
commit c240bbd94f
21 changed files with 343 additions and 92 deletions
@@ -34,6 +34,12 @@ class bookings_o extends db
$this->setTable('bookings');
}
public function objectChanged(): void
{
// Clear the cache
redis->clear_department_booking_count($this->department->value());
}
public function getCustomerBookingsPaginated(int $customer_number, int $page = 1, int $limit = 10, array $order = ['id' => 'DESC'], string $search = null, array $filters = null): array
{
global /** @var response $response */