Closed QuentinLemCode closed 9 years ago
Hello,
Which version of this bundle are you using ? The 1.0.5 or dev-master ? Which version of KnpMenuBundle are you using ?
Can you add your routing.yml for thoses routes ?
Thx
Hello,
Thanks for reply, I'm using your bundle on the branch dev-master, and knp-menu 2.0 Here's my routing.yml :
silca_corsaire_referentiel_accueil:
path: /
defaults: { _controller: SilcaCorsaireReferentielBundle:Referentiel:index}
silca_corsaire_referentiel_ajout:
path: /Ajout
defaults: { _controller: SilcaCorsaireReferentielBundle:Referentiel:add}
silca_corsaire_referentiel_modifier:
path: /Modifier/{codeApp}
defaults: { _controller: SilcaCorsaireReferentielBundle:Referentiel:edit}
silca_corsaire_referentiel_supprimer:
path: /Supprimer
defaults: { _controller: SilcaCorsaireReferentielBundle:Referentiel:delete}
silca_corsaire_referentiel_fill:
path: /Remplir
defaults: { _controller: SilcaCorsaireReferentielBundle:Referentiel:fill}
I try your menu and your routing and i can not reproduce this bug.
For the url : http://dev.flobdev.local/app_dev.php/Ajout
Maybe you don't have the last version of the bundle ? try a composer update
.
You shouln't use the dev-master
for production.
PS :
If you are using the 2.6 version of SF, you shouldn't use the SecurityContext $securityContext
, try to use the security.token_storage
. Cf : http://symfony.com/blog/new-in-symfony-2-6-security-component-improvements .
PS2 :
$user = $securityContext->getToken()->getUser();
Be careful with this, the token and/or the user can be null, this line can throw exceptions. You can move it after the line if( $securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED') )
, if the grant pass, the user should be here ;)
Thank you for your advices ! I will update my code tomorrow. I already updated the bundle to the latest version (with pagerfanta) but the bug was always here.
I think the problem come from the matcher of KNP. I was using an overrided matcher because i don't want to show add/edit/delete pages in the top menu but the "Referentiel" item must have the "active" class and the breadcrumb should show this. However, i commented out the lines in services.yml and the problem was always here :(
I will look further and come back tomorrow
PS : This line in the doc don't work : $menu->setCurrentUri($request->getBaseUrl().$request->getPathInfo());
setCurrentUri
was a method from KNP menu 1.x.
Now, in the template, the matcher give you the current item, in the menu template you have {%- if matcher.isCurrent(item) %}
Okay i have played a bit with xdebug Found the problem, I forget that I have used the setCurrent method in my controller :-1:
Sorry for issue, and thank for your help.
However, I need to find a trick to show the entire breadcrumb whereas the menu show only "Referentiel" as active and don't display dropdown.
Solved with a ->setDisplayChildren(false) on "Referentiel" item :)
Hello everyone
I am a pretty beginner on Symfony, and i'm using this bundle for menu and breadcrumb on an application i'm currently working on. But the breadcrumb don't display the second child of the root.
Here is the code of my menu builder :
Sorry for this dirty piece of code, but i'm working on it !
When I open the route silca_corsaire_referentiel_ajout, the breadcrumb show this :
But it should display "CORSAIRE / REFERENTIEL / AJOUTER UNE APPLICATION"
The others links ('silca_corsaire_referentiel_modifier' and 'silca_corsaire_referentiel_supprimer') don't show the correct breadcrumbs too.
Thanks for your help