ShardingException.php 1.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<?php

namespace Doctrine\DBAL\Sharding;

use Doctrine\DBAL\DBALException;

/**
 * Sharding related Exceptions
 */
class ShardingException extends DBALException
{
Benjamin Morel's avatar
Benjamin Morel committed
12 13 14
    /**
     * @return \Doctrine\DBAL\Sharding\ShardingException
     */
15
    public static function notImplemented()
16
    {
17
        return new self('This functionality is not implemented with this sharding provider.', 1331557937);
18 19
    }

Benjamin Morel's avatar
Benjamin Morel committed
20 21 22
    /**
     * @return \Doctrine\DBAL\Sharding\ShardingException
     */
23
    public static function missingDefaultFederationName()
24
    {
25
        return new self('SQLAzure requires a federation name to be set during sharding configuration.', 1332141280);
26 27
    }

Benjamin Morel's avatar
Benjamin Morel committed
28 29 30
    /**
     * @return \Doctrine\DBAL\Sharding\ShardingException
     */
31
    public static function missingDefaultDistributionKey()
32
    {
33
        return new self('SQLAzure requires a distribution key to be set during sharding configuration.', 1332141329);
34 35
    }

Benjamin Morel's avatar
Benjamin Morel committed
36 37 38
    /**
     * @return \Doctrine\DBAL\Sharding\ShardingException
     */
39
    public static function activeTransaction()
40
    {
41
        return new self('Cannot switch shard during an active transaction.', 1332141766);
42 43
    }

Benjamin Morel's avatar
Benjamin Morel committed
44 45 46
    /**
     * @return \Doctrine\DBAL\Sharding\ShardingException
     */
47
    public static function noShardDistributionValue()
48
    {
49
        return new self('You have to specify a string or integer as shard distribution value.', 1332142103);
50 51
    }

Benjamin Morel's avatar
Benjamin Morel committed
52 53 54
    /**
     * @return \Doctrine\DBAL\Sharding\ShardingException
     */
55
    public static function missingDistributionType()
56 57 58 59
    {
        return new self("You have to specify a sharding distribution type such as 'integer', 'string', 'guid'.");
    }
}