custom/plugins/OkeonlineKejeDocumentImport/src/OkeonlineKejeDocumentImport.php line 9

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Okeonline\KejeDocumentImport;
  3. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  6. class OkeonlineKejeDocumentImport extends Plugin
  7. {
  8.     public function install(InstallContext $installContext): void
  9.     {
  10.         parent::install($installContext);
  11.         $this->insertDocumentTypes($installContext);
  12.     }
  13.     private function insertDocumentTypes(InstallContext $installContext)
  14.     {
  15.         /** @var EntityRepositoryInterface $documentTypeRepository */
  16.         $documentTypeRepository $this->container->get('document_type.repository');
  17.         $documentTypeRepository->upsert(
  18.         [
  19.             [
  20.                 'id' => '56035056fec848d2a55466cbc084fce1',
  21.                 'technicalName' => 'keje_invoice',
  22.                 'name' => 'Keje Invoice'
  23.             ]
  24.         ], $installContext->getContext());
  25.         $documentTypeRepository->upsert(
  26.         [
  27.             [
  28.                 'id' => '56035056fec848d2a55466cbc084fce2',
  29.                 'technicalName' => 'keje_delivery_note',
  30.                 'name' => 'Keje Delivery Note'
  31.             ]
  32.         ], $installContext->getContext());
  33.     }
  34. }