-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
PHPORM-278 Introduce Connection::getDatabase()
and getClient()
#3289
Conversation
Deprecate getMongoDB and get MongoClient
@@ -12,15 +12,18 @@ | |||
|
|||
use function MongoDB\with_transaction; | |||
|
|||
/** @see https://docs.mongodb.com/manual/core/transactions/ */ | |||
/** | |||
* @internal |
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.
Was this class always internal? Just curious if there's a BC concern here.
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.
We try to do better than Laravel's ManagesTransactions
trait, that does not declare its dependencies. This trait is not meant to be used outside of the Connection
class (it should be merged in it but we kept Laravel's design).
Technically, that's a breaking change that is easily overcome by adding a getClient
method to the class that uses it.
$this->assertSame($expected, $connection->getMongoClient()); | ||
} | ||
|
||
public function testLegacyGetMongoDB(): void |
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.
Do these legacy tests need to expect a deprecation message?
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.
Something catches deprecation messages and hides them. I couldn't add an assertion.
@@ -65,9 +68,10 @@ public function __construct(array $config) | |||
|
|||
// Create the connection | |||
$this->connection = $this->createConnection($dsn, $config, $options); | |||
$this->database = $this->getDefaultDatabaseName($dsn, $config); |
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.
Is this dynamically assigning a class property, or is this declared on BaseConnection?
Either way, this appears to be the first time it's being used.
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 property is defined in the parent class, it was not set previously.
Connection::getDatabase()
and getClient
Connection::getDatabase()
and getClient()
And deprecate getMongoDB and get MongoClient
Fix PHPORM-278
Checklist