db = $db->getConnection(); } public function getRecentTicketHistory(\DateTime $startingFrom, int $ticketId): array { $query = $this->db->table('zp_tickethistory') ->where('dateModified', '>=', $startingFrom->format('Y-m-d')); if ($ticketId !== null) { $query->where('ticketId', $ticketId); } $results = $query->orderBy('dateModified', 'desc')->get(); return array_map(fn ($item) => (array) $item, $results->toArray()); } }