66use App \Repository \ReportRepository ;
77use App \Repository \SystemRepository ;
88use Doctrine \ORM \EntityManagerInterface ;
9+ use Symfony \Component \Console \Helper \ProgressBar ;
910use Symfony \Component \DependencyInjection \ParameterBag \ParameterBagInterface ;
1011
1112abstract 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+ abstract protected 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/> ' );
@@ -63,9 +74,9 @@ protected function convertLink(?object $obj): ?string
6374 /**
6475 * @throws \Exception
6576 */
66- protected function convertDate (string $ date ): \ DateTime
77+ protected function convertDate (string $ date ): ? \ DateTimeInterface
6778 {
68- return new \DateTime ($ date );
79+ return empty ( $ date ) ? null : new \DateTimeImmutable ($ date );
6980 }
7081
7182 /**
@@ -76,7 +87,7 @@ protected function convertDate(string $date): \DateTime
7687 protected function convertSystemOwner (array $ systemOwner ): string
7788 {
7889 if (empty ($ systemOwner )) {
79- return '' ;
90+ return '' ;
8091 }
8192
8293 return $ systemOwner [0 ]->LookupValue ?? '' ;
0 commit comments