I have installed FOSUserBundle, SonataUserBundle and SonataAdminBundle
part of my kernel:
$bundles = array(
(...)
new FOS\UserBundle\FOSUserBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
(...)
);
I have
All is working if I disable firewall and acces Sonata admin panel while I am logged off, but if I log in to appliaction and try to access url app_dev.php/admin/dashboard error message appears:
Method "defaultAvatar" for object "Sonata\UserBundle\Twig\GlobalVariables" does not exist in SonataUserBundle:Admin/Core:user_block.html.twig at line 7
I have allready tried to clear cache and reinstall assets, but noothing has changed... Can someone help me solve this issue ?
Ok, I have solved this - maybe it will help someone:
In file 'app/Resources/SonataUserBundle/views/Admin/Core/user_block.html.twig' I have changed line
{% set _user_image = app.user.profilePicture|default(asset(sonata_user.defaultAvatar)) %}
to:
{% set _user_image = false %}
You can also customise the image with another asset... but this was a very quick fix.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.