cakephp3-bootstrap-helpers icon indicating copy to clipboard operation
cakephp3-bootstrap-helpers copied to clipboard

force UrlComparerTrait::_normalize to use GET method

Open Erwane opened this issue 6 years ago • 6 comments

Erwane avatar Jul 09 '19 16:07 Erwane

for issue #179

Erwane avatar Jul 09 '19 16:07 Erwane

Thanks for the PR. Isn't this going to break the opposite case, i.e., if you have a POST URL and you are on a GET one?

Holt59 avatar Jul 09 '19 17:07 Holt59

There is no reason a POST only route need UrlComparerTrait for navlinks i thinks.

Maybe in case of ajax url in data-url attribute ...

Another option is to parse RouteCollection and check url only for route allow current method ?

Erwane avatar Jul 09 '19 18:07 Erwane

I agree with you regarding POST only links in a navigation bar but I would like the UrlComparatorTrait to not be navbar-specific.

Honestly, I don't know why CakePHP has such behaviour... ServerRequest is probably not the right tool for this job, but I have a hard time getting something clean... Comparing CakePHP urls is getting me crazy, this trait was meant to be a small utility tool but it is now probably the most complicated part of the whole helper set.

Holt59 avatar Jul 09 '19 19:07 Holt59

Hi. What we need to advance on this PR ?

Erwane avatar Oct 15 '19 11:10 Erwane

@Erwane A possibility would be to let user specify the method used to compare, with a default to no-method in the UrlComparerTrait (current behavior), but a default to GET in the navbar helper.

This would be retro-compatible, and more flexible for future changes.

Holt59 avatar Oct 16 '19 15:10 Holt59