Skip to content
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

to convert user entity to string #70

Closed
pajooh opened this issue Apr 21, 2012 · 11 comments
Closed

to convert user entity to string #70

pajooh opened this issue Apr 21, 2012 · 11 comments

Comments

@pajooh
Copy link

pajooh commented Apr 21, 2012

trying to see admin dashboard, i get the following:

An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Object of class Symfony\Component\Security\Core\User\User could not be converted to string in /home/pajooh/web/app/cache/dev/twig/67/b2/dee9cd5a99bf1b282fb737c319bd.php line 24") in SonataUserBundle:Admin/Core:user_block.html.twig at line 1.

the problem is that in the user_block.html.twig, the {{ app.user}} can not be converted to string.

@pajooh
Copy link
Author

pajooh commented Apr 26, 2012

actually, i was using the in_memory provider instead of fos_userbundle for security firewall, and thats why the error appears.

@pajooh pajooh closed this as completed Apr 26, 2012
@ivan1986
Copy link

ivan1986 commented May 3, 2012

symfony/symfony#4195

@rande
Copy link
Member

rande commented May 4, 2012

@ivan1986 the SonataUserBundle rely on a __toString method. Now I guess the default use class can be changed. Just create a new one with a __toString method

@ivan1986
Copy link

ivan1986 commented May 4, 2012

i try, it's final class :(

@rande
Copy link
Member

rande commented May 4, 2012

you can create your own class then

@ivan1986
Copy link

ivan1986 commented May 4, 2012

it's not good way, but now i don't know how use not FOS user

but this fix (app.user.username)

{% block user_block %}{% if app.user %}{{ app.user.username }} - <a href="{{ url('sonata_user_admin_security_logout') }}">{{ 'user_block_logout'|trans({}, 'SonataUserBundle') }}</a> {% endif %}{% endblock %}

solve

@kingcrunch
Copy link
Contributor

@rande This is still an issue

@florinutz
Copy link

yes it is.

@BzSpi
Copy link

BzSpi commented Jul 8, 2014

+1
This should be reopened.

@aaaakille
Copy link

i think i got me too +1 (sym2.5 + SonataAdmin + SonataUser + FOS + odm)

An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Object of class Symfony\Component\Security\Core\User\User could not be converted to string in /Users/Jiabin/Sites/symfony-se/app/cache/dev/twig/bf/a1/bc7a7f443294d6c60fccd477994ebea3e18392595772f2fff59093865630.php line 30") in SonataUserBundle:Admin/Core:user_block.html.twig at line 3

@rbarilani
Copy link

+1 ... so it's not possible to use in_memory user provider to login into the admin area?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants