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

Use 'driver' option #16

Closed
RSully opened this issue Aug 6, 2013 · 9 comments
Closed

Use 'driver' option #16

RSully opened this issue Aug 6, 2013 · 9 comments

Comments

@RSully
Copy link

RSully commented Aug 6, 2013

Rather than looking for a connection with a specific name I think it would make more sense to go by driver to follow standard.

Ideally rather than extending eloquent this might extend the database connection system instead, so things like sessions and eloquent "just work" as a result.

@jenssegers
Copy link
Contributor

I did not extend Eloquent, but replaced the DatabaseManager/Builder below. The session drivers are separated from the database.

@RSully
Copy link
Author

RSully commented Aug 6, 2013

It looks like when the Session system is set to "database" it goes through this path https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Connectors/ConnectionFactory.php#L64 (either createConnector or createConnection).

My temporary solution is to extend the session system and add a "mongo" driver, however I feel like this could be something that would be better suited at a lower level.

@jenssegers
Copy link
Contributor

It does indeed call the ConnectionFactory to get the internal PDO object. There is no easy way to get the session system working without a MongoDB session handler.

@jenssegers
Copy link
Contributor

But I will look into MongoDB supported sessions soon.

@jenssegers
Copy link
Contributor

Check out https://github.com/jenssegers/Laravel-MongoDB-Session

It adds a mongodb session driver.

@RSully
Copy link
Author

RSully commented Aug 7, 2013

That is immensely helpful. Thanks.

Regarding the initial reason for this issue though, can you look into getting the database connections based on the "driver" property rather than the key? Right now multiple connections feels kind of janky.

@RSully
Copy link
Author

RSully commented Aug 15, 2013

It looks like 5c6a971 might fix these issues, and from everything I've seen it looks great.

Does this also mean that the session driver is no longer necessary?

Edit: I think the driver is still necessary (but might require modification)

@jenssegers
Copy link
Contributor

I did indeed manage to extend the original database manager with a driver. However, this does not change anything for the session driver, so it is still needed.

@jenssegers
Copy link
Contributor

The only thing that has changed for the session driver is to use the new database manager: jenssegers/laravel-mongodb-session@1ad7858

Smolevich pushed a commit that referenced this issue Feb 17, 2020
Bugfix add collection with options
alcaeus pushed a commit to alcaeus/laravel-mongodb that referenced this issue Aug 16, 2023
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this issue Sep 2, 2024
Bugfix add collection with options
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

2 participants