ShardingException.php 1.5 KB

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