1 | <?php |
||
29 | abstract class AbstractEnumType extends Type |
||
30 | { |
||
31 | /** |
||
32 | * @var string $name Name of this type |
||
33 | */ |
||
34 | protected $name = ''; |
||
35 | |||
36 | /** |
||
37 | * @var array $choices Array of ENUM Values, where ENUM values are keys and their readable versions are values |
||
38 | * @static |
||
39 | */ |
||
40 | protected static $choices = []; |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function convertToDatabaseValue($value, AbstractPlatform $platform) |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function requiresSQLCommentHint(AbstractPlatform $platform) |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | public function getName() |
||
99 | |||
100 | /** |
||
101 | * Get readable choices for the ENUM field |
||
102 | * |
||
103 | * @static |
||
104 | * |
||
105 | * @return array Values for the ENUM field |
||
106 | */ |
||
107 | public static function getChoices() |
||
116 | |||
117 | /** |
||
118 | * Get values for the ENUM field |
||
119 | * |
||
120 | * @static |
||
121 | * |
||
122 | * @return array Values for the ENUM field |
||
123 | */ |
||
124 | public static function getValues() |
||
128 | |||
129 | /** |
||
130 | * Get value in readable format |
||
131 | * |
||
132 | * @param string $value ENUM value |
||
133 | * |
||
134 | * @static |
||
135 | * |
||
136 | * @return string|null $value Value in readable format |
||
137 | * |
||
138 | * @throws \InvalidArgumentException |
||
139 | */ |
||
140 | public static function getReadableValue($value) |
||
148 | |||
149 | /** |
||
150 | * Check if some string value exists in the array of ENUM values |
||
151 | * |
||
152 | * @param string $value ENUM value |
||
153 | * |
||
154 | * @return bool |
||
155 | */ |
||
156 | public static function isValueExist($value) |
||
160 | } |
||
161 |