From 5c5c7cece179df07d3c5b16562d705e9ff9608fb Mon Sep 17 00:00:00 2001 From: Marc Kreidler Date: Sun, 29 Mar 2026 22:04:10 +0200 Subject: [PATCH] Try to fix "Iterate with fetch join in class App\Entity\Parts\PartLot using association part not allowed." when opening BOM --- src/DataTables/ProjectBomEntriesDataTable.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DataTables/ProjectBomEntriesDataTable.php b/src/DataTables/ProjectBomEntriesDataTable.php index 4bf10855..a3e82181 100644 --- a/src/DataTables/ProjectBomEntriesDataTable.php +++ b/src/DataTables/ProjectBomEntriesDataTable.php @@ -185,7 +185,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface ]) ->add('storageLocations', TextColumn::class, [ 'label' => 'part.table.storeLocations', - 'orderField' => 'NATSORT(MIN(storageLocations.name))', + 'orderField' => 'NATSORT(storageLocationOrder)', 'visible' => false, 'render' => function ($value, ProjectBOMEntry $context) { if ($context->getPart() !== null) { @@ -226,6 +226,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface { $builder->select('bom_entry') ->addSelect('part') + ->addSelect('(SELECT MIN(storageLocationSort.name) FROM ' . \App\Entity\Parts\PartLot::class . ' partLotSort LEFT JOIN partLotSort.storage_location storageLocationSort WHERE partLotSort.part = part) AS HIDDEN storageLocationOrder') ->from(ProjectBOMEntry::class, 'bom_entry') ->leftJoin('bom_entry.part', 'part') ->leftJoin('part.category', 'category')