ShardingException.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace Doctrine\DBAL\Sharding;
  3. use Doctrine\DBAL\DBALException;
  4. /**
  5. * Sharding related Exceptions
  6. */
  7. class ShardingException extends DBALException
  8. {
  9. /**
  10. * @return \Doctrine\DBAL\Sharding\ShardingException
  11. */
  12. public static function notImplemented()
  13. {
  14. return new self('This functionality is not implemented with this sharding provider.', 1331557937);
  15. }
  16. /**
  17. * @return \Doctrine\DBAL\Sharding\ShardingException
  18. */
  19. public static function missingDefaultFederationName()
  20. {
  21. return new self('SQLAzure requires a federation name to be set during sharding configuration.', 1332141280);
  22. }
  23. /**
  24. * @return \Doctrine\DBAL\Sharding\ShardingException
  25. */
  26. public static function missingDefaultDistributionKey()
  27. {
  28. return new self('SQLAzure requires a distribution key to be set during sharding configuration.', 1332141329);
  29. }
  30. /**
  31. * @return \Doctrine\DBAL\Sharding\ShardingException
  32. */
  33. public static function activeTransaction()
  34. {
  35. return new self('Cannot switch shard during an active transaction.', 1332141766);
  36. }
  37. /**
  38. * @return \Doctrine\DBAL\Sharding\ShardingException
  39. */
  40. public static function noShardDistributionValue()
  41. {
  42. return new self('You have to specify a string or integer as shard distribution value.', 1332142103);
  43. }
  44. /**
  45. * @return \Doctrine\DBAL\Sharding\ShardingException
  46. */
  47. public static function missingDistributionType()
  48. {
  49. return new self("You have to specify a sharding distribution type such as 'integer', 'string', 'guid'.");
  50. }
  51. }