From 4f94b0c00d80fe1c34d6ef0f2d580ff4aee17dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gracjan=20J=C3=B3zefczyk?= Date: Wed, 22 May 2024 06:40:01 +0200 Subject: [PATCH] OP-277: Replace DTO with array --- src/Form/Type/SearchFacetsType.php | 2 -- src/Model/Search.php | 7 +++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Form/Type/SearchFacetsType.php b/src/Form/Type/SearchFacetsType.php index de31e68b..0e54ab21 100644 --- a/src/Form/Type/SearchFacetsType.php +++ b/src/Form/Type/SearchFacetsType.php @@ -13,7 +13,6 @@ namespace BitBag\SyliusElasticsearchPlugin\Form\Type; use BitBag\SyliusElasticsearchPlugin\Facet\RegistryInterface; -use BitBag\SyliusElasticsearchPlugin\Model\SearchFacets; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -56,6 +55,5 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('facets'); - $resolver->setDefault('data_class', SearchFacets::class); } } diff --git a/src/Model/Search.php b/src/Model/Search.php index 2c22061c..7655d65a 100644 --- a/src/Model/Search.php +++ b/src/Model/Search.php @@ -16,12 +16,11 @@ class Search { private ?SearchBox $box; - private ?SearchFacets $facets; + private array $facets = []; public function __construct() { $this->box = new SearchBox(); - $this->facets = new SearchFacets(); } public function getBox(): ?SearchBox @@ -34,12 +33,12 @@ public function setBox(?SearchBox $box): void $this->box = $box; } - public function getFacets(): ?SearchFacets + public function getFacets(): array { return $this->facets; } - public function setFacets(?SearchFacets $facets): void + public function setFacets(array $facets): void { $this->facets = $facets; }