-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Updated "Load security users from database" #1874
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
Conversation
I've updated the "How to load Security Users from the Database" cookbook to include fix this error: PHP Fatal error: Call to a member function getRole() on a non-object in /vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php on line 47 which is happening in PHP > 5.4. The fix is taken by this issue: symfony/symfony#3691 (comment)
*/ | ||
public function serialize() | ||
{ | ||
return \serialize(array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need a \
prefix if you use a function?
Ok, fixing them now |
Hi Alessandro! I agree that this is a good note to add :). But, I believe if you're using the entity provider (i.e. I also think that our implementation of Let me know if you agree! And if so, let's at least make the changes to only serialize the Thanks for bringing this to attention! |
Actually I don't remember why I've serialized all the fields of the user, maybe to pass it from a request to another saving it in the session... But generally I think it's ok to just serialize the id for most of the cases... I'll do the changes requested, don't worry. I'm on the ipad so I'll try with the github editor, if it doesn't work I'll turn on the pc later.. Just have some patience ;) |
Serialize with only the id field, refreshed user is called by id
The refreshUser is ok this way? Else feel free to comment or edit ;) |
Hi Alessandro! What is the purpose of adding the serialize to the Thanks! |
Hi Ryan, |
@weaverryan ok removed the serialisation from the Group entity, seems to still works fine. |
…tion of why serialization might be important
Hi Alessandro! Ah, great - thanks so much for testing this without the I also made a few very small tweaks. Thanks! |
Oh true, nice tweaks! Thanks! |
I've updated the "How to load Security Users from the Database" cookbook to include fix this error:
PHP Fatal error: Call to a member function getRole() on a non-object in /vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php on line 47
which is happening in PHP > 5.4.
The fix is taken by this issue: symfony/symfony#3691 (comment)