1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php use TYPO3\CMS\Core\Http\ImmediateResponseException; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Controller\ErrorController; class SomeController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { public function someAction($id) { if (!SomeModel::find($id)) { $response = GeneralUtility::makeInstance(ErrorController::class) ->pageNotFoundAction($GLOBALS['TYPO3_REQUEST'], 'Record not found.'); throw new ImmediateResponseException($response, 1617116194); } } } |