src/Bidcoz/Bundle/FrontendBundle/Form/Type/Donation/CashType.php line 15

Open in your IDE?
  1. <?php
  2. namespace Bidcoz\Bundle\FrontendBundle\Form\Type\Donation;
  3. use RS\DiExtraBundle\Annotation as DI;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\MoneyType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\Validator\Constraints\NotBlank;
  8. use Symfony\Component\Validator\Constraints\Range;
  9. /**
  10.  * @DI\FormType
  11.  */
  12. class CashType extends AbstractType
  13. {
  14.     public function buildForm(FormBuilderInterface $builder, array $options)
  15.     {
  16.         $builder
  17.             ->add('amount'MoneyType::class, [
  18.                 'currency'    => 'USD',
  19.                 'constraints' => [
  20.                     new NotBlank(),
  21.                     new Range([
  22.                         'min' => 0,
  23.                     ]),
  24.                 ],
  25.             ])
  26.         ;
  27.     }
  28.     public function getBlockPrefix()
  29.     {
  30.         return 'donate_cash';
  31.     }
  32. }