{% set license = craft.digitalProducts.licenses.orderId(orderId).one() %}
where orderId is a valid order ID, causes this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'digitalproducts_products.orderId' in 'where clause'
The SQL being executed was: SELECT `elements`.`id`, `elements`.`fieldLayoutId`, `elements`.`uid`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_sites`.`slug`, `elements_sites`.`uri`, `elements_sites`.`enabled` AS `enabledForSite`, `digitalproducts_licenses`.`id`, `digitalproducts_licenses`.`productId`, `digitalproducts_licenses`.`licenseKey`, `digitalproducts_licenses`.`ownerName`, `digitalproducts_licenses`.`ownerEmail`, `digitalproducts_licenses`.`userId`, `digitalproducts_licenses`.`orderId`
FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`
FROM `elements` `elements`
INNER JOIN `digitalproducts_licenses` `digitalproducts_licenses` ON `digitalproducts_licenses`.`id` = `elements`.`id`
INNER JOIN `digitalproducts_products` `digitalproducts_products` ON `digitalproducts_licenses`.`productId` = `digitalproducts_products`.`id`
LEFT JOIN `users` `users` ON `digitalproducts_licenses`.`userId` = `users`.`id`
INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id`
WHERE (`digitalproducts_products`.`orderId`=507) AND (`elements_sites`.`siteId`='1') AND (`elements`.`archived`=FALSE) AND (`elements`.`enabled`='1') AND (`elements_sites`.`enabled`=TRUE)
ORDER BY `digitalproducts_licenses`.`dateCreated` DESC
LIMIT 1) `subquery`
INNER JOIN `digitalproducts_licenses` `digitalproducts_licenses` ON `digitalproducts_licenses`.`id` = `subquery`.`elementsId`
INNER JOIN `elements` `elements` ON `elements`.`id` = `subquery`.`elementsId`
INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId`
ORDER BY `digitalproducts_licenses`.`dateCreated` DESC
In a template:
where
orderId
is a valid order ID, causes this error: