1 | <?php |
||
2 | |||
3 | namespace Zenstruck\Foundry\Test; |
||
4 | |||
5 | use Doctrine\Persistence\ManagerRegistry; |
||
6 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
||
7 | |||
8 | /** |
||
9 | * @internal |
||
10 | */ |
||
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) { |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
![]() |
|||
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> */ |
||
0 ignored issues
–
show
The type
Zenstruck\Foundry\Test\list was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
49 | private function objectManagersToReset(): array |
||
50 | { |
||
51 | return [$this->registry->getDefaultManagerName()]; |
||
0 ignored issues
–
show
|
|||
52 | } |
||
53 | } |
||
54 |