19 lines
547 B
PHP
19 lines
547 B
PHP
<?php
|
|
|
|
class Comment extends \DB\SQL\Mapper {
|
|
function __construct($db)
|
|
{
|
|
parent::__construct($db, 'ticket_comments');
|
|
}
|
|
|
|
public function findWithUserByTicketId($ticket_id){
|
|
return $this->db->exec(
|
|
'SELECT c.*, u.username AS author_name
|
|
FROM ticket_comments c
|
|
LEFT JOIN users u ON c.created_by = u.id
|
|
WHERE c.ticket_id = ?
|
|
ORDER BY c.created_at DESC',
|
|
[$ticket_id]
|
|
);
|
|
}
|
|
} |