1 | <?php declare(strict_types=1); |
||
2 | /** |
||
3 | * Spiral Framework. |
||
4 | * |
||
5 | * @license MIT |
||
6 | * @author Anton Titov (Wolfy-J) |
||
7 | */ |
||
8 | |||
9 | namespace Cycle\Schema\Generator; |
||
10 | |||
11 | use Cycle\Schema\GeneratorInterface; |
||
12 | use Cycle\Schema\Registry; |
||
13 | |||
14 | /** |
||
15 | * Declare table dropped (initiate diff calculation). |
||
16 | */ |
||
17 | final class CleanTables implements GeneratorInterface |
||
18 | { |
||
19 | /** |
||
20 | * @param Registry $registry |
||
21 | * @return Registry |
||
22 | */ |
||
23 | public function run(Registry $registry): Registry |
||
24 | { |
||
25 | foreach ($registry as $entity) { |
||
26 | if (!$registry->hasTable($entity)) { |
||
27 | continue; |
||
28 | } |
||
29 | |||
30 | if (!$entity->getOptions()->has(RenderTables::READONLY)) { |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
31 | $registry->getTableSchema($entity)->declareDropped(); |
||
32 | } |
||
33 | } |
||
34 | |||
35 | return $registry; |
||
36 | } |
||
37 | } |