Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A license without a linked order results in an error #100

Open
berrytimmermans opened this issue Jun 14, 2024 · 3 comments
Open

A license without a linked order results in an error #100

berrytimmermans opened this issue Jun 14, 2024 · 3 comments

Comments

@berrytimmermans
Copy link

Description

When one of the licenses is not linked to an order because it was, for instance, manually created, the query below in the example results in: Invalid Argument – yii\base\InvalidArgumentException - Invalid numeric value.

{% set licenses = craft.digitalProducts
        .licenses
        .owner(currentUser)
        .with(['product', 'order'])
        .all()
%}

Steps to reproduce

1.Use the example in the template: Displaying the licensed product for the currently logged-in Craft User.
2.Add a license via the control panel, so that no order is linked.

Additional info

  • Craft version: 4.10.0
  • PHP version: 8.1.28
  • Database driver & version: MySQL 8.0.33
  • Plugins & versions:

Craft Commerce 4.6.2
Digital Products 3.2.3
Freeform 5.3.5
Link Vault 4.0.4
Mollie for Craft Commerce 4.2.0
Redactor 3.1.0
Redactor Anchors 1.5.0

Copy link

linear bot commented Jun 14, 2024

@lukeholder
Copy link
Member

@berrytimmermans could you post the full stack trace please - I will then take a look into it. Thanks

@lukeholder lukeholder self-assigned this Jun 19, 2024
@berrytimmermans
Copy link
Author

berrytimmermans commented Jun 28, 2024

Thanks @lukeholder for your response, here's the stack trace.

yii\base\InvalidArgumentException: Invalid numeric value:  in /var/www/html/vendor/craftcms/cms/src/helpers/Db.php:599
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/helpers/Db.php(850): craft\helpers\Db::parseParam('elements.id', Array, '=', false, 'integer')
#1 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1464): craft\helpers\Db::parseNumericParam('elements.id', Array)
#2 /var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder))
#3 /var/www/html/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\commerce\elements\db\OrderQuery))
#4 /var/www/html/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Query->createCommand(Object(craft\db\Connection))
#5 /var/www/html/vendor/craftcms/cms/src/db/Query.php(252): yii\db\Query->all(NULL)
#6 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1632): craft\db\Query->all(NULL)
#7 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3038): craft\elements\db\ElementQuery->all()
#8 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(2916): craft\services\Elements->_eagerLoadElementsInternal('craft\\digitalpr...', Array, Array)
#9 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(3247): craft\services\Elements->eagerLoadElements('craft\\digitalpr...', Array, Array)
#10 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1589): craft\elements\db\ElementQuery->_createElements(Array)
#11 /var/www/html/vendor/yiisoft/yii2/db/Query.php(251): craft\elements\db\ElementQuery->populate(Array)
#12 /var/www/html/vendor/craftcms/cms/src/db/Query.php(252): yii\db\Query->all(NULL)
#13 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1632): craft\db\Query->all(NULL)
#14 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1635): craft\elements\db\ElementQuery->all()
#15 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(142): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\digitalproducts\elements\db\LicenseQuery), 'all', Array, 'method', false, false, false, 5)
#16 /var/www/html/storage/runtime/compiled_templates/9b/9b3e352ded4922edfa62f6b5b2e047ad.php(42): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\digitalproducts\elements\db\LicenseQuery), 'all', Array, 'method', false, false, false, 5)
#17 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_c5fa357502bd87af03b8671c316d0acf->doDisplay(Array, Array)
#18 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#19 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#20 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#21 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\TemplateWrapper->render(Array)
#22 /var/www/html/vendor/craftcms/cms/src/web/View.php(488): Twig\Environment->render('shop/account/er...', Array)
#23 /var/www/html/vendor/craftcms/cms/src/web/View.php(541): craft\web\View->renderTemplate('shop/account/er...', Array)
#24 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate('shop/account/er...', Array, 'site')
#25 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1109): craft\web\TemplateResponseFormatter->format(Object(craft\web\Response))
#26 /var/www/html/vendor/craftcms/cms/src/web/Response.php(338): yii\web\Response->prepare()
#27 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#28 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#29 /var/www/html/public_html/index.php(12): yii\base\Application->run()
#30 {main}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants