Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | class ImmutableCaster |
||
10 | { |
||
11 | public static function castSchemaToImmutable(Schema $schema): void |
||
12 | { |
||
13 | foreach ($schema->getTables() as $table) { |
||
14 | foreach ($table->getColumns() as $column) { |
||
15 | self::toImmutableType($column); |
||
16 | } |
||
17 | } |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * Changes the type of a column to an immutable date type if the type is a date. |
||
22 | * This is needed because by default, when reading a Schema, Doctrine assumes a mutable datetime. |
||
23 | */ |
||
24 | private static function toImmutableType(Column $column): void |
||
36 | } |
||
37 | } |
||
39 |