19 private const ON_GET_PROVIDER_EVENT =
'onGetContractorsProvider';
20 private const ON_GET_CONVERTER_EVENT =
'onGetContractorsConverter';
27 $converter = self::getConverter();
33 static $isMigrating =
false;
34 if (!$converter::isMigrated())
39 $converter::runMigration();
45 return self::getProvider($providerName);
48 public static function isActiveProviderExists(): bool
50 $event =
new Event(
'catalog', self::ON_GET_PROVIDER_EVENT);
53 $resultList = $event->getResults();
55 if (is_array($resultList))
58 foreach ($resultList as $eventResult)
60 $providers = $eventResult->getParameters();
61 foreach ($providers as $provider)
82 return $provider && $provider::getModuleId() === $moduleId;
92 $converter = self::getConverter();
95 && !$converter::isMigrated()
98 $converter::showMigrationProgress();
101 return ob_get_clean();
107 private static function getProvider(
string $providerName): ?
IProvider
109 $event =
new Event(
'catalog', self::ON_GET_PROVIDER_EVENT);
112 $resultList = $event->getResults();
114 if (is_array($resultList))
117 foreach ($resultList as $eventResult)
119 $providers = $eventResult->getParameters();
120 foreach ($providers as $name => $provider)
122 if ($name === $providerName && $provider instanceof
IProvider)
133 private static function getConverter(): ?IConverter
135 $event =
new Event(
'catalog', self::ON_GET_CONVERTER_EVENT);
138 $resultList = $event->getResults();
140 if (is_array($resultList))
143 foreach ($resultList as $eventResult)
145 $provider = $eventResult->getParameters();
146 if ($provider instanceof IConverter)