xfra35 / f3-multilang

Create multilingual apps with this localization plugin for the PHP Fat-Free Framework
GNU General Public License v3.0
48 stars 13 forks source link

Can't handle two different aliases with same route endpoint #25

Open n0nag0n opened 3 years ago

n0nag0n commented 3 years ago

Hey there,

Just was messing with this today and I had 2 routes that pointed to the same endpoint, but had different aliases. Multilang was not a fan haha.

GET @companies: /companies = Company->indexAction ; routes to /en/companies
GET @companies_create: /companies/create = Company->createAction; routes to /en/companies/create
POST @companies_handle_create: /companies/create = Company->handleCreateAction; ERROR routes to /companies/create

Without doing a ton of digging, I'm better the problem lies in the rewrite() method in Multilang. Don't know if this is a feature or a bug, please advise :smile:

ikkez commented 3 years ago

As far as I know, you cannot give the same route /companies/create two different named aliases via their request type (GET|POST)

n0nag0n commented 3 years ago

I'll have to try that in a bit and see. I know this works, but not sure about if you throw aliases in front of it.

GET /users/create = User_Controller->createAction
POST /users/create = User_Controller->create