Fetch preview attachment directly in table query.

This reduces the query count and therfore improves performance.
This commit is contained in:
Jan Böhmer 2019-11-15 19:13:53 +01:00
parent b0fd346369
commit 2e3c1d6c0a

View file

@ -82,10 +82,14 @@ class PartsDataTable implements DataTableTypeInterface
->addSelect('footprint') ->addSelect('footprint')
->addSelect('manufacturer') ->addSelect('manufacturer')
->addSelect('partUnit') ->addSelect('partUnit')
->addSelect('master_picture_attachment')
->addSelect('footprint_attachment')
->from(Part::class, 'part') ->from(Part::class, 'part')
->leftJoin('part.category', 'category') ->leftJoin('part.category', 'category')
->leftJoin('part.master_picture_attachment', 'master_picture_attachment')
->leftJoin('part.partLots', 'partLots') ->leftJoin('part.partLots', 'partLots')
->leftJoin('part.footprint', 'footprint') ->leftJoin('part.footprint', 'footprint')
->leftJoin('footprint.master_picture_attachment', 'footprint_attachment')
->leftJoin('part.manufacturer', 'manufacturer') ->leftJoin('part.manufacturer', 'manufacturer')
->leftJoin('part.orderdetails', 'orderdetails') ->leftJoin('part.orderdetails', 'orderdetails')
->leftJoin('part.partUnit', 'partUnit'); ->leftJoin('part.partUnit', 'partUnit');