Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class ODMSchemaResetter extends AbstractSchemaResetter |
||
12 | { |
||
13 | /** @var Application */ |
||
14 | private $application; |
||
15 | /** @var ManagerRegistry */ |
||
16 | private $registry; |
||
17 | |||
18 | public function __construct(Application $application, ManagerRegistry $registry) |
||
19 | { |
||
20 | $this->application = $application; |
||
21 | $this->registry = $registry; |
||
22 | } |
||
23 | |||
24 | public function resetSchema(): void |
||
25 | { |
||
26 | foreach ($this->objectManagersToReset() as $manager) { |
||
27 | try { |
||
28 | $this->runCommand( |
||
29 | $this->application, |
||
30 | 'doctrine:mongodb:schema:drop', |
||
31 | [ |
||
32 | '--dm' => $manager, |
||
33 | ] |
||
34 | ); |
||
35 | } catch (\Exception $e) { |
||
|
|||
36 | } |
||
37 | |||
38 | $this->runCommand( |
||
39 | $this->application, |
||
40 | 'doctrine:mongodb:schema:create', |
||
41 | [ |
||
42 | '--dm' => $manager, |
||
43 | ] |
||
44 | ); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | /** @return list<string> */ |
||
49 | private function objectManagersToReset(): array |
||
52 | } |
||
53 | } |
||
54 |