From b500fa82bb40423fdb7fb102376b1cad8d2328bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Tue, 24 Oct 2023 14:08:50 +0200 Subject: [PATCH] Allow to dynamically create currencies in pricedetails This fixes issue #413 --- src/Form/Part/PricedetailType.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Form/Part/PricedetailType.php b/src/Form/Part/PricedetailType.php index c8df4c71..cabb112d 100644 --- a/src/Form/Part/PricedetailType.php +++ b/src/Form/Part/PricedetailType.php @@ -27,12 +27,18 @@ use App\Entity\PriceInformations\Pricedetail; use App\Form\Type\BigDecimalNumberType; use App\Form\Type\CurrencyEntityType; use App\Form\Type\SIUnitType; +use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; class PricedetailType extends AbstractType { + + public function __construct(private readonly Security $security) + { + } + public function buildForm(FormBuilderInterface $builder, array $options): void { //No labels needed, we define translation in templates @@ -63,6 +69,7 @@ class PricedetailType extends AbstractType 'required' => false, 'label' => false, 'short' => true, + 'allow_add' => $this->security->isGranted('@currencies.create'), ]); }