I have this query:
public function warnBelowCostPrices(Application $app) {
$em = $app['orm.em'];
ini_set('xdebug.var_display_max_depth', 3);
ini_set('xdebug.var_display_max_data', 40);
try {
//basic option check
$optionQuery = $em->createQuery('
SELECT o FROM m:Option o JOIN m:Product p
WHERE o.costPriceVariation > 0 AND o.price > 0 AND o.stock > 0
AND (o.costPriceVariation >= o.price OR p.costPrice >= o.price)
');
$options = $optionQuery->getResult();
//var_dump($options);
} catch (\Exception $e) {
var_dump($e);
die();
}
Which is causing a 500 error. This is the only code executed in the call I am testing and nothing appears in the logs.
Can anyone see why this would occur?
OK worked this out
SELECT o FROM m:Option o JOIN m:Product p
should be
SELECT o FROM m:Option o JOIN o.product
I thought it was implied that I wanted the second approach, but apparently I have to explicitly state it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.