New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router::extensions(['pdf']) not respected #147
Comments
AFAIR that's not a 3.1 specific problem, it was always like that, as it's a feature so that global extensions cannot randomly "pollute" routes. |
In that case https://github.com/FriendsOfCake/CakePdf/blob/master/config/routes.php#L4 is highly misleading and should be removed. |
I would have suggested that too. In any case an explanation would be required in the docs, so promoting the "correct", manual approach of adding extensions is probably the way to go (not sure if one could call moving the |
By default, using plugin routes to register extensions for application routes happens too late, which will cause the automatic PDF view functionality to not be triggered for URLs with the `pdf` extension. Therefore the extension is best to be registered manually when needed. Resolves FriendsOfCake#147
So is there an solution for this problem? I already "wasted" more then 10 hours in that issue. |
Call me again after 72 hours of no sleep, no food, and no water, when you're one step away from setting your computer on fire and chopping it into pieces with a rabid weasel tied to a spiked mace, you're not real developer until then :) On a serious note, check the updated readme: https://github.com/ndm2/CakePdf/blob/ffbeddfccb61f57262248fe5ab8de3769fedb34b/README.md#setup |
OMG! This works! I had it at the end at some desperate point...... But it actually needs to be above the routes scope. Thanks so much! I am flipping my shit! |
Closing as PR #153 is open to update readme. |
using routes=>true on Plugin::load() should enable pdf as extension.
So I only have Router::extensions(['json']); in my own app routes.php because those should be merged.
And debugging the CakePdf routes.php file shows: They are merged:
But then, the controller does not work:
It seems something in 3.1 goes wrong here regarding extension handling in routes.
I suspect that the routes parsing happens before the extensions could all be set when relying on plugin routes.php files.
The text was updated successfully, but these errors were encountered: