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

Add --shard option to doctrine commands #456

Merged
merged 2 commits into from
Jun 21, 2016
Merged

Add --shard option to doctrine commands #456

merged 2 commits into from
Jun 21, 2016

Conversation

vincentchalamon
Copy link
Contributor

I need to use shard connections in my project, but it seems that some code is not up to date with sharding. This PR add some compatibility & options with shard connections.

}
foreach ($options['shards'] as $i => $shard) {
if (!isset($shard['driver'])) {
$options['shards'][$i]['driver'] = $options['driver'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is that ? the PoolingShardConnection does not need to specify the driver for each shard (it does not make any sense to have a different driver per shard)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause it will throw an exception to require driver or driverOptions in shard connection if this parameter is missing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where would it throw an exception ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example when executing a doctrine:database:create command

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, then doctrine:database:create should be fixed instead when it builds params in a special way instead of using the configured params.
Adding useless params is the wrong way (the DriverManager will never read $params['shard'][$i]['driver'] but always $params['driver'])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@vincentchalamon vincentchalamon changed the title [WIP] Add --shard option to doctrine commands Add --shard option to doctrine commands Aug 19, 2015
@vincentchalamon vincentchalamon changed the title Add --shard option to doctrine commands Add --shard option to doctrine commands Aug 20, 2015

if ($shardId) {
if (!$manager->getConnection() instanceof PoolingShardConnection) {
throw new \LogicException(sprintf("Connection of EntityManager '%s' must implements shards configuration.", $name));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"must implement"

@guillaumevoisin
Copy link

👍

1 similar comment
@MLKiiwy
Copy link

MLKiiwy commented Sep 3, 2015

👍

@vincentchalamon
Copy link
Contributor Author

@deeky666 Can you also have a look at it please ? :)

@dunglas
Copy link
Contributor

dunglas commented Oct 29, 2015

👍

In another PR it would be nice to refactor the create and the drop commands: they share a lot of common code and code duplication is bad :-)

@vincentchalamon
Copy link
Contributor Author

Up ! @stof @deeky666

@kimhemsoe kimhemsoe merged commit 7829867 into doctrine:master Jun 21, 2016
@kimhemsoe
Copy link
Member

Thanks @vincentchalamon

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

Successfully merging this pull request may close these issues.

6 participants