mongodb-bundle icon indicating copy to clipboard operation
mongodb-bundle copied to clipboard

Deprecated ReadPreference::getMode

Open Vegeeto opened this issue 1 year ago • 1 comments

According to the official documentation, the getMode() has been deprecated and will be removed in version 2.0 of MongoDB extension.

Usage on file src/Capsule/Collection.php, method translateReadPreference (line 210)

I suggest refactor translateReadPreference method to the following one:

    private function readPreferenceMode(ReadPreference $readPreference): string
    {
        return $readPreference->getModeString();
    }

Reference: https://www.php.net/manual/es/mongodb-driver-readpreference.getmode.php

Vegeeto avatar Sep 26 '24 08:09 Vegeeto

Note: getModeString() is present since 1.7.0, so this would need a slight bump to the ext-mongodb requirement: https://www.php.net/manual/en/mongodb-driver-readpreference.getmodestring.php

Jean85 avatar Sep 26 '24 08:09 Jean85