diff --git a/CHANGELOG.md b/CHANGELOG.md index cd58faa..2a52cc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ See [keep a changelog] for information about writing changes to this log. ## [Unreleased] +* [PR-39](https://github.com/itk-dev/sysstatus/pull/39) + Prevented duplicating inactive reports and systems * [PR-38](https://github.com/itk-dev/sysstatus/pull/38) * Update importers * Add example data diff --git a/README.md b/README.md index 5ded34d..1e5ae98 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Make sure you have a set of JSON files for testing import Commands. ### Start Docker containers ```shell -docker compose up -d +docker compose up --detach docker compose exec phpfpm composer install docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction ``` @@ -37,7 +37,7 @@ docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interact ### Create a super admin user ```sh -docker compose exec phpfpm bin/console SuperUser +docker compose exec phpfpm bin/console app:user:create admin@example.com --password password --role=ROLE_SUPER_ADMIN ``` ### Access the site @@ -88,7 +88,7 @@ flowchart TD Theme[Theme] ThemeCategory[ThemeCategory] User[User] - + fos_user_user_group{{JoinTable: fos_user_user_group }} group_system_themes{{JoinTable: group_system_themes }} group_report_themes{{JoinTable: group_report_themes }} @@ -111,7 +111,7 @@ flowchart TD System --- |ManyToMany| SelServiceAFI Theme --- |ManyToOne| ThemeCategory - + Answers --- |ManyToOne| Question Question -- JoinCollum Answers and Question --o Answers diff --git a/Taskfile.yml b/Taskfile.yml index 73241e7..85ce32a 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -5,7 +5,7 @@ dotenv: ['.env.local', '.env'] vars: # https://taskfile.dev/reference/templating/ - BASE_URL: '{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default "https://hoeringsportal.local.itkdev.dk"}}' + BASE_URL: '{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default "https://itstyr.local.itkdev.dk"}}' DOCKER_COMPOSE: '{{.TASK_DOCKER_COMPOSE | default "docker compose"}}' tasks: diff --git a/src/Service/BaseImporter.php b/src/Service/BaseImporter.php index 5759b15..0331f89 100644 --- a/src/Service/BaseImporter.php +++ b/src/Service/BaseImporter.php @@ -6,6 +6,7 @@ use App\Repository\ReportRepository; use App\Repository\SystemRepository; use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; abstract class BaseImporter implements ImportInterface @@ -22,6 +23,16 @@ public function __construct( $this->url = $this->params->get('system_url') ?? ''; } + public function import(string $src, ?ProgressBar $progressBar = null): void + { + // We need to be able to find all entities during import. + $this->entityManager->getFilters()->disable('entity_active'); + + $this->doImport($src, $progressBar); + } + + abstract protected function doImport(string $src, ?ProgressBar $progressBar): void; + protected function sanitizeText(string $str): ?string { $str = strip_tags($str, '