Skip to content

Commit a653969

Browse files
committed
7131: Disabled doctrine filter in data importers
1 parent 94ddf93 commit a653969

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/Service/BaseImporter.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Repository\ReportRepository;
77
use App\Repository\SystemRepository;
88
use Doctrine\ORM\EntityManagerInterface;
9+
use Symfony\Component\Console\Helper\ProgressBar;
910
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1011

1112
abstract class BaseImporter implements ImportInterface
@@ -22,6 +23,16 @@ public function __construct(
2223
$this->url = $this->params->get('system_url') ?? '';
2324
}
2425

26+
public function import(string $src, ?ProgressBar $progressBar = null): void
27+
{
28+
// We need to be able to find all entities during import.
29+
$this->entityManager->getFilters()->disable('entity_active');
30+
31+
$this->doImport($src, $progressBar);
32+
}
33+
34+
protected abstract function doImport(string $src, ?ProgressBar $progressBar): void;
35+
2536
protected function sanitizeText(string $str): ?string
2637
{
2738
$str = strip_tags($str, '<p><div><strong><a><ul><li><span><br><br/>');

src/Service/ReportImporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class ReportImporter extends BaseImporter
99
{
10-
public function import(string $src, ?ProgressBar $progressBar = null): void
10+
public function doImport(string $src, ?ProgressBar $progressBar = null): void
1111
{
1212
$json = file_get_contents($src);
1313
$entries = json_decode($json);

src/Service/SystemImporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(
2424
parent::__construct($reportRepository, $systemRepository, $groupRepository, $entityManager, $params);
2525
}
2626

27-
public function import(string $src, ?ProgressBar $progressBar = null): void
27+
public function doImport(string $src, ?ProgressBar $progressBar = null): void
2828
{
2929
$json = file_get_contents($src);
3030
$entries = json_decode($json);

0 commit comments

Comments
 (0)