avanzu / AdminThemeBundle

Admin Theme based on the AdminLTE Template for easy integration into symfony
MIT License
281 stars 149 forks source link

Notice: Undefined index: login #179

Closed nehalist closed 6 years ago

nehalist commented 6 years ago

Fresh install, using "avanzu/admin-theme-bundle": "dev-master" with Symfony 3.3* and PHP 7.* triggers:

Twig_Error_Runtime:
An exception has been thrown during the rendering of a template ("Notice: Undefined index: login").

  at vendor/avanzu/admin-theme-bundle/Resources/views/layout/login-layout.html.twig:50

Reverting to v1.3.4 results in #175. Even if the proposed fix (changing the bower.json) works - I'm not going to modify vendors, that's for sure.

Additionally, I'm not really a big fan of having dev-master in my deps. Hotfixing should be done via patch releases, not via commits to master...

shakaran commented 6 years ago

Hi @nehalist dev-master is at this moment unstable. The stable version is 1.3. With 1.3 you are living in old code, so trying Symfony 3.3 and PHP 7 probably would be difficult. Thats the reason of prepare a stable 2.0 version. I am helping with maintenance and improvement of this bundle, since last 1-2 years the maintainer don't have a lot time to it.

I know that dev-master is not very suitable to use in composer.json, thats because I am releasing "pre-releases" when I get some things resolved. Last release was today with 2.0.0.beta.7

It seems that your bug with the path route login, it is because you don't have defined a route called "login", so since you are using the login-layout.html.twig you should define a route called "login", which is exactly as expect the line 50. But I will try to make a fix detecting if the route exist, but I am not sure if twig allows detect exactly that, probably will be needed in the controller. For #175, you only need remove admin-lte 2.4 and use 2.3.x

shakaran commented 6 years ago

@nehalist I push a fix. It seems that last author create a "feature" as twig extension called route_alias that search in a RouteAliasCollection and it was not checking the unexistant index in a route alias array. So you don't should get now the warning with latest commit, but I am not sure how it will display for you having a unexistant "login" route. Probably a null route, that should be empty string. Let me know if you have the chance to try it.

nehalist commented 6 years ago

OT: Even though I've wasted a serious amount of time today trying to fix things regarding this bundle, I appreciate your support and commitment. Thanks for that and keep the good work.

I've applied 1.3.5 recently and for now everything seems to work. I'm not going back to dev-master as long as I'm not forced to - as long as everything is working I will try my best to avoid touching anything which has nothing to do with my real application - hence no testing for that from my side at the moment.

shakaran commented 6 years ago

@nehalist thanks for the words and sorry if you lost some time, hopefully new code and version should be more stable. I gonna close this issue since I think that it is fixed, but reopen in any moment when you want try master in future and if you have the same issue