fix(custom-fields) : include customFields and customFieldValues in product normalization
normalizeProduct() had customFields hardcoded to [] and was missing customFieldValues entirely, unlike normalizeComposant and normalizePiece. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -711,6 +711,7 @@ class MachineStructureController extends AbstractController
|
|||||||
$pieces = [];
|
$pieces = [];
|
||||||
foreach ($composant->getPieceSlots() as $slot) {
|
foreach ($composant->getPieceSlots() as $slot) {
|
||||||
$pieceData = [
|
$pieceData = [
|
||||||
|
'slotId' => $slot->getId(),
|
||||||
'typePieceId' => $slot->getTypePiece()?->getId(),
|
'typePieceId' => $slot->getTypePiece()?->getId(),
|
||||||
'quantity' => $slot->getQuantity(),
|
'quantity' => $slot->getQuantity(),
|
||||||
'selectedPieceId' => $slot->getSelectedPiece()?->getId(),
|
'selectedPieceId' => $slot->getSelectedPiece()?->getId(),
|
||||||
@@ -769,16 +770,19 @@ class MachineStructureController extends AbstractController
|
|||||||
|
|
||||||
private function normalizeProduct(Product $product): array
|
private function normalizeProduct(Product $product): array
|
||||||
{
|
{
|
||||||
|
$type = $product->getTypeProduct();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $product->getId(),
|
'id' => $product->getId(),
|
||||||
'name' => $product->getName(),
|
'name' => $product->getName(),
|
||||||
'reference' => $product->getReference(),
|
'reference' => $product->getReference(),
|
||||||
'supplierPrice' => $product->getSupplierPrice(),
|
'supplierPrice' => $product->getSupplierPrice(),
|
||||||
'typeProductId' => $product->getTypeProduct()?->getId(),
|
'typeProductId' => $type?->getId(),
|
||||||
'typeProduct' => $this->normalizeModelType($product->getTypeProduct()),
|
'typeProduct' => $this->normalizeModelType($type),
|
||||||
'constructeurs' => $this->normalizeConstructeurs($product->getConstructeurs()),
|
'constructeurs' => $this->normalizeConstructeurs($product->getConstructeurs()),
|
||||||
'documents' => [],
|
'documents' => [],
|
||||||
'customFields' => [],
|
'customFields' => $type ? $this->normalizeCustomFieldDefinitions($type->getProductCustomFields()) : [],
|
||||||
|
'customFieldValues' => $this->normalizeCustomFieldValues($product->getCustomFieldValues()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user