Я разрабатываю плагин для Shopware 6, и мне нужна для него эта библиотека QR-кодов. Моя проблема в том, что когда я пытаюсь запустить библиотеку, я продолжаю получать вышеупомянутые сообщения об ошибках.
Все пространства имен правильные, все установлено через Composer и готово. Мой пример точно такой же, как на Packagist, но я все равно получаю эту ошибку.
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\Label\LabelAlignment;
use Endroid\QrCode\Label\Font\NotoSans;
use Endroid\QrCode\RoundBlockSizeMode;
use Endroid\QrCode\Writer\PngWriter;
$result = Builder::create()
->writer(new PngWriter())
->writerOptions([])
->data('Custom QR code contents')
->encoding(new Encoding('UTF-8'))
->errorCorrectionLevel(ErrorCorrectionLevel::High)
->size(300)
->margin(10)
->roundBlockSizeMode(RoundBlockSizeMode::Margin)
->logoPath(__DIR__.'/assets/symfony.png')
->logoResizeToWidth(50)
->logoPunchoutBackground(true)
->labelText('This is the label')
->labelFont(new NotoSans(20))
->labelAlignment(LabelAlignment::Center)
->validateResult(false)
->build();
Я также пытался реализовать это с помощью другой библиотеки (bacon/bacon-qr-code), и он также жаловался на ту же проблему, но только с другим пространством имен ImageRenderer
В чем может быть проблема? Я использую Docker (v4.34.4), Symfony (v6.6.6.1) и PHP (v8.3)
РЕДАКТИРОВАТЬ 13.10.2024
www-data@741042a1609d:~/html$ php bin/console cache:clear
// Clearing the cache for the dev environment with debug true
// Warming up cache...
// Warming up optional cache...
// Removing old build and cache directory...
// Finished
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
www-data@741042a1609d:~/html$ cd custom/plugins/ShrQrProGen/
www-data@741042a1609d:~/html/custom/plugins/ShrQrProGen$ composer dump-autoload -o
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:879
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:884
Generating optimized autoload files
Generated optimized autoload files containing 9983 classes
www-data@741042a1609d:~/html/custom/plugins/ShrQrProGen$ tail -f ../../../var/log/dev.log
[2024-10-13T18:36:35.730919+00:00] app.INFO: #9 Rule detection: Alle Kunden der Standard-Kundengruppe with priority 1 (id: 28caae75a5624f0d985abd0eb32aa160) [] []
[2024-10-13T18:36:35.732180+00:00] php.INFO: User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\Core\Checkout\Payment\Cart\PaymentHandler\PrePayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\\Core\\Checkout\\Payment\\Cart\\PaymentHandler\\PrePayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. at /var/www/html/vendor/shopware/core/Checkout/Payment/Cart/PaymentHandler/PaymentHandlerRegistry.php:48)"} []
[2024-10-13T18:36:35.732326+00:00] php.INFO: User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\Core\Checkout\Payment\Cart\PaymentHandler\DebitPayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\\Core\\Checkout\\Payment\\Cart\\PaymentHandler\\DebitPayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. at /var/www/html/vendor/shopware/core/Checkout/Payment/Cart/PaymentHandler/PaymentHandlerRegistry.php:48)"} []
[2024-10-13T18:36:35.732418+00:00] php.INFO: User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\Core\Checkout\Payment\Cart\PaymentHandler\CashPayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\\Core\\Checkout\\Payment\\Cart\\PaymentHandler\\CashPayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. at /var/www/html/vendor/shopware/core/Checkout/Payment/Cart/PaymentHandler/PaymentHandlerRegistry.php:48)"} []
[2024-10-13T18:36:35.732509+00:00] php.INFO: User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\Core\Checkout\Payment\Cart\PaymentHandler\InvoicePayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\\Core\\Checkout\\Payment\\Cart\\PaymentHandler\\InvoicePayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. at /var/www/html/vendor/shopware/core/Checkout/Payment/Cart/PaymentHandler/PaymentHandlerRegistry.php:48)"} []
[2024-10-13T18:36:35.732590+00:00] php.INFO: User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\Core\Checkout\Payment\Cart\PaymentHandler\DefaultPayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since shopware/core : The tag `shopware.payment.method.sync` is deprecated for service Shopware\\Core\\Checkout\\Payment\\Cart\\PaymentHandler\\DefaultPayment and will be removed in 6.7.0. Use `shopware.payment.handler` instead. at /var/www/html/vendor/shopware/core/Checkout/Payment/Cart/PaymentHandler/PaymentHandlerRegistry.php:48)"} []
[2024-10-13T18:36:35.869849+00:00] php.INFO: User Deprecated: Since shopware/core : Method "Shopware\Storefront\Page\Product\ProductPage::setReviews()" is deprecated and will be removed in v6.7.0.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since shopware/core : Method \"Shopware\\Storefront\\Page\\Product\\ProductPage::setReviews()\" is deprecated and will be removed in v6.7.0.0. at /var/www/html/vendor/shopware/core/Framework/Feature.php:242)"} []
[2024-10-13T18:36:35.869992+00:00] php.INFO: User Deprecated: Since shopware/core : Method "Shopware\Storefront\Page\Product\ProductPage::setCrossSellings()" is deprecated and will be removed in v6.7.0.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since shopware/core : Method \"Shopware\\Storefront\\Page\\Product\\ProductPage::setCrossSellings()\" is deprecated and will be removed in v6.7.0.0. at /var/www/html/vendor/shopware/core/Framework/Feature.php:242)"} []
[2024-10-13T18:36:35.870170+00:00] app.INFO: QrProGenSubscriber: onProductPageLoaded [] []
[2024-10-13T18:36:36.066754+00:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\ClassNotFoundError: "Attempted to load class "Builder" from namespace "Endroid\QrCode\Builder". Did you forget a "use" statement for e.g. "Lcobucci\JWT\Token\Builder" or "Lcobucci\JWT\Builder"?" at QrProGenSubscriber.php line 105 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\ClassNotFoundError(code: 0): Attempted to load class \"Builder\" from namespace \"Endroid\\QrCode\\Builder\".\nDid you forget a \"use\" statement for e.g. \"Lcobucci\\JWT\\Token\\Builder\" or \"Lcobucci\\JWT\\Builder\"? at /var/www/html/custom/plugins/ShrQrProGen/src/Subscriber/QrProGenSubscriber.php:105)"} []
ИЗМЕНИТЬ 14.10.2024
composer.json
{
..
"require": {
"shopware/core": "6.6.*",
"endroid/qr-code": "^5.1"
},
"autoload": {
"psr-4": {
"Shr\\QrProGen\\": "src/"
}
},
..
}
ShrQrProGen.php
Подробнее здесь: https://stackoverflow.com/questions/790 ... endroid-qr
ClassNotFoundError: попытка загрузить класс «Builder» из пространства имен «Endroid\QrCode\Builder». ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение