From bc058c137baf1e3858f40591aa4bd0179f73c5a3 Mon Sep 17 00:00:00 2001 From: Peter Dulacka Date: Mon, 12 Aug 2024 10:56:05 +0200 Subject: [PATCH] Fix use of internal seeder within open-source modules (cherry picked from commit a946827aae2eca67cb34b8491d7d1485d4d75875) --- src/Seeders/AddressTypesTestSeeder.php | 35 ++++++++++++++++++++++++++ src/config/config.neon | 1 + 2 files changed, 36 insertions(+) create mode 100644 src/Seeders/AddressTypesTestSeeder.php diff --git a/src/Seeders/AddressTypesTestSeeder.php b/src/Seeders/AddressTypesTestSeeder.php new file mode 100644 index 0000000..df4a3fe --- /dev/null +++ b/src/Seeders/AddressTypesTestSeeder.php @@ -0,0 +1,35 @@ + 'Dummy address type for tests', + ]; + + foreach ($types as $type => $title) { + if ($this->addressTypesRepository->findBy('type', $type)) { + $output->writeln(" * address type {$type} exists"); + } else { + $this->addressTypesRepository->insert([ + 'type' => $type, + 'title' => $title, + ]); + $output->writeln(" * address type {$type} created"); + } + } + } +} diff --git a/src/config/config.neon b/src/config/config.neon index 96355bd..4d82b65 100644 --- a/src/config/config.neon +++ b/src/config/config.neon @@ -189,6 +189,7 @@ services: - Crm\UsersModule\Seeders\UsersSeeder - Crm\UsersModule\Seeders\SnippetsSeeder - Crm\UsersModule\Seeders\MeasurementsSeeder + - Crm\UsersModule\Seeders\AddressTypesTestSeeder - Crm\UsersModule\Components\UserSourceAccesses\UserSourceAccesses - Crm\UsersModule\Components\UserTokens\UserTokens - Crm\UsersModule\Models\Auth\Rate\WrongPasswordRateLimit