Skip to main content


Since TYPO3 uses a lot of the components of Symfony already, it would be great if Extbase would also be similar to Symfony.

Symfony has 2 great features which are currently missing in Extbase:

  1. Allow to specify allowed methods for an action (GET, POST, PUT…)
  2. Set permissions which user is allowed to call actions

Surprisingly the backend is already feature number one where you can define allowed methods in typo3/sysext/backend/Configuration/Backend/Routes.php for example like so:
<pre><code class="lang-php">'login_request_token' => [
'path' => '/login/request-token',
'access' => 'public',
'methods' => ['POST'],
'target' => Controller\LoginController::class . '::requestTokenAction',
],
</code></pre>
Because the routing works completely different in Extbase, it is time to rethink it.

My proposal is to also use Annotations like in Symfony also in Extbase like so:
<pre><code class="lang-php">class BackendUserController extends ActionController
{
#[Route(path: '/removeFromCompareList/{uid}/{redirectToCompare}', name: 'removeFromCompareList', methods: ['POST'])]
#[IsGranted('customer')]
public function removeFromCompareListAction(int $uid, int $redirectToCompare = 0): ResponseInterface
{
$this->removeFromCompareList('compareUserList', $uid);
if ($redirectToCompare) {
return $this->redirect('compare');
}
return $this->redirect('index');
}
}
</code></pre>
What are your thoughts about it?

Would this be something that could be implemented for TYPO3 13?

2 posts - 2 participants

Jens Neumann reshared this.