From bae3299e5f2b1455d5aece43f08b65f21d140cbd Mon Sep 17 00:00:00 2001 From: Benoit VIGNAL Date: Fri, 6 Sep 2024 22:07:30 +0200 Subject: [PATCH] Add csv export for sales --- config/normalizer_csv/sale.yml | 25 +++++++++++++++++++++++++ src/Entity/Sale.php | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 config/normalizer_csv/sale.yml diff --git a/config/normalizer_csv/sale.yml b/config/normalizer_csv/sale.yml new file mode 100644 index 0000000..bbc32a1 --- /dev/null +++ b/config/normalizer_csv/sale.yml @@ -0,0 +1,25 @@ +App\Entity\Sale: + id: ~ + createdAt: ~ + updatedAt: ~ + price: ~ + comment: ~ + + seller: + prefix: seller + fields: + fullName: ~ + + paymentMode: + prefix: paymentMode + fields: + name: ~ + + salePurchasedItems: + prefix: item + fields: + id: ~ + itemName: name + itemCategory: category + itemPrice: price + quantity: ~ diff --git a/src/Entity/Sale.php b/src/Entity/Sale.php index 2e2ec63..192547a 100644 --- a/src/Entity/Sale.php +++ b/src/Entity/Sale.php @@ -43,7 +43,8 @@ denormalizationContext: [ 'groups' => ['sale', 'sale-write', 'timestamp-write-create'] ], - order: ['createdAt' => 'DESC'] + order: ['createdAt' => 'DESC'], + paginationClientEnabled: true, )] #[ApiFilter(OrderFilter::class, properties: ['createdAt' => 'DESC'])] #[ApiFilter(SearchFilter::class, properties: ['seller.id' => 'exact'])]