-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Reworded the docs about storing sessions in database #12325
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
The docs are correct per se, but there's the issue of MongoDB ODM 1.x only working with the legacy driver, which is no longer supported by the session class. We've suggested people on PHP 7 use The code you provided will work out of the box in MongoDB ODM 2.0, which will be released soon. Until then we're kind of stuck in limbo. |
@javiereguiluz I'm not seeing any specific about the Redis handler? |
@dkarlovi maybe the new file Could you please check if the Redis connection setup, etc. is correct? Thanks! |
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.
Why isn't MemcachedSessionHandler mentioned at all, while it also exists in the core ?
|
||
.. note:: | ||
|
||
MongoDB ODM 1.x only works with the legacy driver, which is no longer |
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.
Why taking about MongoDB ODM here ? This handler is not using the ODM at all.
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.
The service uses the MongoDB connection service created by ODM, which is why it's worth mentioning. The alternative is creating a separate MongoDB\Client
instance for use with sessions, which users may do. Maybe that's worth explaining as well?
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.
The service uses the MongoDB connection service created by ODM, which is why it's worth mentioning.
I don't understand this statement. The MongodbSessionHandler expects a \MongoDB\Client
or \MongoClient
or \Mongo
. It does not use the Doctrine wrappers.
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 understand this statement. The MongodbSessionHandler expects a
\MongoDB\Client
or\MongoClient
or\Mongo
.
The MongoDB session handler expects a \MongoDB\Client
object since Symfony 4 - using the \MongoClient
or the deprecated \Mongo
class was removed in 4.0 as those classes aren't readily available on PHP 7 (as the legacy driver was never made compatible with PHP 7).
It does not use the Doctrine wrappers.
That is correct, but the service configuration shown in the docs uses the default connection that is created when using MongoDB ODM. This reuses connection info like the URL, auth details, and more to avoid users having to duplicate that info. Of course, users may very well set up a separate connection for this purpose in ODM or create their own \MongoDB\Client
instance to configure the service.
One could go and set up the MongoDB session storage without ODM, but chances are people using MongoDB for session storage might also be using it for something else, in which case the ODM is the recommended way to go.
@javiereguiluz do you think there should be instructions for setting up the client without using the ODM? While I think it could be helpful for some people, I'm worried that it will confuse people as to what version to choose. On the other hand, for people that aren't using ODM this might give the impression that they need the ODM solely for the purpose of storing sessions, which is not correct.
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'm afraid I don't understand what you are discussing about. Please, tell me what should I do here: remove this note? Reword it? Thanks.
@stof Memcached was a popular project a few years ago, but I think it's been overtaken by Redis: I've asked on Symfony's Slack and most people seem to use Redis only. |
I agree that Redis should be more prominent that Memcached. But given that we have support for Memcached in core, I think it deserves at least a mention in the doc.
with that argument to reject MemcachedHandler, why is MongodbHandler documented then ? |
a704843
to
6038f18
Compare
3927f2d
to
e0617ce
Compare
e0617ce
to
1b21aa4
Compare
1b21aa4
to
500d961
Compare
This is part of our ongoing effort to reword all Doctrine related docs.
I'll summon the power of the Symfony community to review this:
The file to review is the new file
session/database.rst
. Here's how it looks rendered: https://github.com/javiereguiluz/symfony-docs/blob/b2ef983b79110cff8f85abeeffe78aa18f6bf31a/session/database.rstThank you all!