79700912

Date: 2025-07-14 13:04:35
Score: 0.5
Natty:
Report link

The main challenge is to ensure the new route wouldn't stop you from using your existing routes, this could be managed with parameter validation https://symfony.com/doc/current/routing.html#route-parameters

depends what you are putting in your slug? it needs to be unique otherwise /train-set you couldn't tell if it was /product/train-set or /category/train-set

/{entity}-{id} if you validate entity as \w+ and id as a \d+ and you don't have any existing routes for say /ouryear-2025 it could work for you.

An alternative would be don't put the slug directly in your entity but put in into a new entity "Slug" with a relationship to the entity, then that would stop anyone from creating an identical slug across entities if given a unique constraint.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Alex Dawn