AmountCurrencyType

Amount with currency: combination of a NumberType input and a ChoiceType input (for currency selection).

Type options

Option Type Default value Description
label boolean false
amount_constraints string []
inherit_data boolean true
currencies array []

Code example

$builder
   ->add('amount_currency', AmountCurrencyType::class, [
        'amount_constraints' => [
            new NotNull(),
            new GreaterThan([
                'value' => 0,
                'message' => $this->translator->trans(
                    'Invalid value: the payment must be a positive amount.', [], 'Admin.Notifications.Error'
                ),
            ]),
        ],
        'currencies' => $this->currencySymbolByIdChoiceProvider->getChoices([
            'id_shop' => $this->contextShopId,
        ]),
    ])

Preview example

AmountCurrencyType rendered in form example