$connection
->execute(
static fn (Tsx $tsx): string => <<<SQL
select first_name
from users
where user_id = {$tsx($userId)}
SQL
)
->rowColumn('first_name')
->fetch(static fn() => throw new \Exception(\sprintf( // < стрелочной функции нельзя выставить never даже если throw
'User with id %s was not found.',
$userId
)))
;
Post #948
1.18K
- 👍 4