Core parameters in Symfony routes

Questions around the Aimeos bundle for the Symfony framework
Forum rules
Always add your Symfony, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
garwat82
Posts: 16
Joined: 18 Dec 2014, 11:07

Core parameters in Symfony routes

Post by garwat82 » 14 Jan 2015, 17:00

Hi there

Tried to make some parameters like "d-product-id" part of the Symfony route, e.g. "/detail/{d-product-id}" but that doesn't work as Symfony allows only word characters and no dashes for the placeholders. I'm thinking about converting dashes to underscores somewhere but this may collide if a parameter name will contain an underscore in the future. Are there any other feasable options?

Regards,

Garret
Last edited by garwat82 on 14 Jan 2015, 18:10, edited 1 time in total.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Core parameters in Symfony routes

Post by aimeos » 14 Jan 2015, 17:25

Hi Garret

This seems to be a bigger problem and converting the dashes to underscores forth and back in the bundle isn't a viable solution as you've already noted. Is there no way to patch Symfony to allow dashes in parameter names?

garwat82
Posts: 16
Joined: 18 Dec 2014, 11:07

Re: Core parameters in Symfony routes

Post by garwat82 » 14 Jan 2015, 17:35

I did some research and asked the Symfony developers yesterday and both was negative. The Symfony developers wouldn't do this either as it will complicate things a lot for them (see https://github.com/symfony/symfony/issues/13400). They suggested to do this in the bundle and I fear this isn't a great solution too.

The only way to get a compatible and good solution seems to be changing the parameter names in the core to "d_product_id" and maybe shorten the name in the same step to e.g. "d_prodid". What do you think?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Core parameters in Symfony routes

Post by aimeos » 14 Jan 2015, 17:54

I see and I'm always hesitating making incompatible changes to the core. But if this is the only good option we have then do it ...

garwat82
Posts: 16
Joined: 18 Dec 2014, 11:07

Re: Core parameters in Symfony routes

Post by garwat82 » 14 Jan 2015, 18:09

OK, I will care about this and get back to you when its done.

Garret

garwat82
Posts: 16
Joined: 18 Dec 2014, 11:07

Re: Core parameters in Symfony routes

Post by garwat82 » 15 Jan 2015, 21:55

Hey folks

The necessary changes are done and the tests succeed: https://github.com/aimeos/arcavias-core/pull/4

Regards,

Garret

Post Reply