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

getShardManager function not defined #2371

Closed
duhruh opened this issue Apr 21, 2016 · 4 comments
Closed

getShardManager function not defined #2371

duhruh opened this issue Apr 21, 2016 · 4 comments
Labels

Comments

@duhruh
Copy link

duhruh commented Apr 21, 2016

The comments for doctrine/dbal:PoolingShardConnection indicate that we are able to run the function getShardManager on the returned connection. However this will not work since for whatever reason the function PoolingShardConnection::getShardManager wasn't carried over from doctrine/shards:PoolingShardConnection. Was this intended, or are we responsible for bringing in the sharding library. If we are responsible then i'm not sure why a copy of this exists in it's own repository and in this one.

Edit: okay it looks like getShardManager was intentionally removed in this commit b6f48e1 so can the documentation be updated as to the recommend way to get the shard manager and select a shard.

Edit: Okay i didn't feel like waiting 😝 I'm assuming this is the recommended way to handle this now

        $chooser = new MultiTenantShardChoser();
        $conn = DriverManager::getConnection([
                'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', 'driver' => 'pdo_mysql',
                'global' =>['user' => '', 'password' => '', 'host' => '', 'dbname' => ''],
                'shards' => [
                    ['id' => 1, 'user' => 'slave1', 'password', 'host' => '', 'dbname' => ''],
                    ['id' => 2, 'user' => 'slave2', 'password', 'host' => '', 'dbname' => ''],
                ],
                'shardChoser' => $chooser,
            ]);

        $shardManager = new PoolingShardManager($conn, $chooser);
        $shardManager->selectGlobal();
        $shardManager->selectShard(1);

if so can you update the docs for other poor helpless souls out there struggling with this like me 😄

last thing if you do update these docs can you guys please update the word shardChoser in the code, chooser is spelt with 2 O's i.e. shardChooser

last last thing i also just noticed that there's no reason for shardChoser to even be passed into PoolingShardConnection as it doesn't reference this at all, unless there's something i'm missing. Since you guys took out getShardManager i think that was the only reference to the shard choser, so since you removed one of them, shouldn't you remove both?

@lorenzleutgeb
Copy link

I just came across the same issue(s). I am happy to provide a PR that fixes documentation and stays backward compatible with 2.5.

@Ocramius would you be willing to receive such a PR?

@Ocramius
Copy link
Member

Ocramius commented Aug 25, 2017 via email

@morozov
Copy link
Member

morozov commented Jul 13, 2021

Closing as no longer supported (#3602).

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants