1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Quantum PHP Framework |
5
|
|
|
* |
6
|
|
|
* An open source software development framework for PHP |
7
|
|
|
* |
8
|
|
|
* @package Quantum |
9
|
|
|
* @author Arman Ag. <[email protected]> |
10
|
|
|
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) |
11
|
|
|
* @link http://quantum.softberg.org/ |
12
|
|
|
* @since 2.8.0 |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Quantum\Exceptions; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* MigrationException class |
19
|
|
|
* |
20
|
|
|
* @package Quantum |
21
|
|
|
* @category Exceptions |
22
|
|
|
*/ |
23
|
|
|
class MigrationException extends AppException |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @return \Quantum\Exceptions\MigrationException |
27
|
|
|
*/ |
28
|
|
|
public static function wrongDirection(): MigrationException |
29
|
|
|
{ |
30
|
|
|
return new static(t('exception.wrong_migration_direction'), E_ERROR); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param string $action |
35
|
|
|
* @return MigrationException |
36
|
|
|
*/ |
37
|
|
|
public static function unsupportedAction(string $action): MigrationException |
38
|
|
|
{ |
39
|
|
|
return new static(t('exception.non_supported_action', $action), E_ERROR); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param string $name |
44
|
|
|
* @return \Quantum\Exceptions\MigrationException |
45
|
|
|
*/ |
46
|
|
|
public static function tableAlreadyExists(string $name): MigrationException |
47
|
|
|
{ |
48
|
|
|
return new static(t('exception.table_already_exists', $name), E_ERROR); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param string $name |
53
|
|
|
* @return \Quantum\Exceptions\MigrationException |
54
|
|
|
*/ |
55
|
|
|
public static function tableDoesnotExists(string $name): MigrationException |
56
|
|
|
{ |
57
|
|
|
return new static(t('exception.table_does_not_exists', $name), E_ERROR); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $name |
62
|
|
|
* @return \Quantum\Exceptions\MigrationException |
63
|
|
|
*/ |
64
|
|
|
public static function columnNotAvailable(string $name): MigrationException |
65
|
|
|
{ |
66
|
|
|
return new static(t('exception.column_not_available', $name), E_ERROR); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param string $name |
71
|
|
|
* @return \Quantum\Exceptions\MigrationException |
72
|
|
|
*/ |
73
|
|
|
public static function methodNotDefined(string $name): MigrationException |
74
|
|
|
{ |
75
|
|
|
return new static(t('exception.method_not_defined', $name), E_ERROR); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return \Quantum\Exceptions\MigrationException |
80
|
|
|
*/ |
81
|
|
|
public static function nothingToMigrate(): MigrationException |
82
|
|
|
{ |
83
|
|
|
return new static(t('exception.nothing_to_migrate'), E_NOTICE); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
} |
87
|
|
|
|