'onInitDatanormImporter', 'DatanormReaderFactory' => 'onInitDatanormReaderFactory', ]; } /** * @param ContainerInterface $container * * @return DatanormImporter */ public static function onInitDatanormImporter(ContainerInterface $container): DatanormImporter { return new DatanormImporter( self::onInitDatanormIntermediateService($container), self::onInitDatanormIntermediateGateway($container), self::onInitDatanormConverter(), self::onInitArticleService($container), $container->get('SellingPriceService'), $container->get('PurchasePriceService'), self::onInitAdressWrapper($container), self::onInitDatanormEnricher($container) ); } /** * @param ContainerInterface $container * * @return DatanormReaderFactory */ public static function onInitDatanormReaderFactory(ContainerInterface $container): DatanormReaderFactory { $handlers[] = new DatanormReaderVersionFiveHandler(); $handlers[] = new DatanormReaderVersionFourHandler(); return new DatanormReaderFactory( self::onInitDatanormIntermediateService($container), $handlers, $container->get('FilesystemFactory') ); } /** * @param ContainerInterface $container * * @return DatanormIntermediateService */ public static function onInitDatanormIntermediateService(ContainerInterface $container): DatanormIntermediateService { return new DatanormIntermediateService($container->get('Database')); } /** * @param ContainerInterface $container * * @return DatanormIntermediateGateway */ public static function onInitDatanormIntermediateGateway(ContainerInterface $container): DatanormIntermediateGateway { return new DatanormIntermediateGateway($container->get('Database')); } /** * * @return DatanormConverter */ public static function onInitDatanormConverter(): DatanormConverter { return new DatanormConverter(); } /** * @param ContainerInterface $container * * @return ArticleService */ public static function onInitArticleService(ContainerInterface $container): ArticleService { return new ArticleService($container->get('Database')); } /** * @param ContainerInterface $container * * @return AddressWrapper */ private static function onInitAdressWrapper(ContainerInterface $container): AddressWrapper { /** @var ApplicationCore $app */ $app = $container->get('LegacyApplication'); return new AddressWrapper( $container->get('Database'), $app->erp ); } /** * @param ContainerInterface $container * * @return DatanormEnricher */ private static function onInitDatanormEnricher(ContainerInterface $container): DatanormEnricher { return new DatanormEnricher( self::onInitDatanormIntermediateGateway($container) ); } }