In my web app if a user is logged in and clicks on the logo, instead of going to the entry page as an anonymous user, I would load their member homepage URL instead.
How it works is when a user joins or logs in, I generate this route $this->generateUrl('member_page'), array('member' => $member->getName()));
and my route is configured as so,
member_page: pattern: /member/{member}/
defaults: { _controller: HomeBundle:Default:member }
and it generates this url:
http://website.com/member/John+joe/
The problem is, when I recall the route it just shows this url
http://website.com/member/
I have tried calling a new action and using $request->getURI() but it does not maintain the dynamic get parameters.
I’m trying to avoid a call to the DB to get the user name each time the click the logo.
Any help would be great, thanks!
A few weeks ago, I had to do something quite similar and inspired myself from the PagerFantaBundle. Have you tried this code in your controller: