Ich aktualisiere das Plugin von 6.4 auf 6.5, aber ich bekomme den folgenden Fehler:
Hier ist der Teil meines PHP-Codes, der „session“ verwendet. Siehe Zeile 3.
Hier ist, was ich hatte:
<?php
namespace ErpSpecialPrice\Subscriber;
use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\Session\Session;
use Shopware\Core\Checkout\Cart\Event\BeforeLineItemAddedEvent;
use Shopware\Core\Checkout\Cart\Event\BeforeLineItemQuantityChangedEvent;
use Shopware\Core\Checkout\Cart\Event\BeforeLineItemRemovedEvent;
use Shopware\Core\Checkout\Cart\Event\CheckoutOrderPlacedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\PrefixFilter;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\Uuid\Uuid;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\AndFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter;
use Shopware\Core\Defaults;
use Shopware\Core\Checkout\Cart\LineItem\LineItemCollection;
use Shopware\Core\Content\Product\Aggregate\ProductPrice\ProductPriceCollection;
//use Shopware\Core\Checkout\Cart\Rule\LineItemCustomFieldRule;
Ich habe einen Blog über das Update gelesen und Github Copilot verwendet, und es wurde vorgeschlagen, stattdessen Folgendes zu verwenden, aber es scheint nicht zu funktionieren. Hier ist es (siehe Zeile 4):
<?php
namespace ErpSpecialPrice\Subscriber;
use Doctrine\DBAL\Connection;
//use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Request;
// Diese Methode sollte innerhalb der Klassendefinition sein
class Subscriber implements EventSubscriberInterface
{
public function indexAction(Request $request) {
$session = $request->getSession();
// do something with the session object
}
}
use Shopware\Core\Checkout\Cart\Event\BeforeLineItemAddedEvent;
use Shopware\Core\Checkout\Cart\Event\BeforeLineItemQuantityChangedEvent;
use Shopware\Core\Checkout\Cart\Event\BeforeLineItemRemovedEvent;
use Shopware\Core\Checkout\Cart\Event\CheckoutOrderPlacedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\PrefixFilter;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\Uuid\Uuid;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\AndFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter;
use Shopware\Core\Defaults;
use Shopware\Core\Checkout\Cart\LineItem\LineItemCollection;
use Shopware\Core\Content\Product\Aggregate\ProductPrice\ProductPriceCollection;
//use Shopware\Core\Checkout\Cart\Rule\LineItemCustomFieldRule;
Hat jemand eine Idee, was das Problem sein könnte?
Danke