You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "ActionController" page does not talk about how to properly throw a 404 error when e.g. a record cannot be found in the database.
Expected behavior/output
Example code how to throw a 404 page.
use TYPO3\CMS\Core\Http\ImmediateResponseException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Controller\ErrorController;
if ($record === null) {
$response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
$GLOBALS['TYPO3_REQUEST'], 'Record not found'
);
throw new ImmediateResponseException($response, 1704787250);
}
Current behavior
The "ActionController" page does not talk about how to properly throw a 404 error when e.g. a record cannot be found in the database.
Expected behavior/output
Example code how to throw a 404 page.
Links
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/Extbase/Reference/Controller/ActionController.html
TYPO3 versions
12, main
The text was updated successfully, but these errors were encountered: