custom/plugins/NextagCheckout/src/NextagCheckout.php line 13

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Nextag\Checkout;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  5. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  6. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  7. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  8. use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult;
  9. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  10. class NextagCheckout extends Plugin
  11. {
  12.     public function uninstall(UninstallContext $uninstallContext): void
  13.     {
  14.         if ($uninstallContext->keepUserData()) {
  15.             return;
  16.         }
  17.     }
  18.     public function activate(ActivateContext $context): void
  19.     {
  20.         parent::activate($context);
  21.         $repository $this->container->get('system_config.repository');
  22.         $results $repository->search((new Criteria())->addFilter(new EqualsFilter('configurationKey''core.loginRegistration.invalidateSessionOnLogOut')), $context->getContext());
  23.         if ($results->first() && $results->getTotal() > 0) {
  24.             foreach ($results as $r) {
  25.                 $repository->update([
  26.                     [
  27.                         'id' => $r->getId(),
  28.                         'configurationValue' => false
  29.                     ]
  30.                 ], $context->getContext());
  31.             }
  32.         }
  33.     }
  34. }