vendor/sylius/sylius/src/Sylius/Bundle/OrderBundle/Form/Type/CartItemType.php line 21

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\OrderBundle\Form\Type;
  12. use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
  13. use Symfony\Component\Form\DataMapperInterface;
  14. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  15. use Symfony\Component\Form\FormBuilderInterface;
  16. class CartItemType extends AbstractResourceType
  17. {
  18.     public function __construct(
  19.         string $dataClass,
  20.         array $validationGroups,
  21.         private DataMapperInterface $dataMapper,
  22.     ) {
  23.         parent::__construct($dataClass$validationGroups);
  24.     }
  25.     public function buildForm(FormBuilderInterface $builder, array $options): void
  26.     {
  27.         $builder
  28.             ->add('quantity'IntegerType::class, [
  29.                 'attr' => ['min' => 1],
  30.                 'label' => 'sylius.ui.quantity',
  31.             ])
  32.             ->setDataMapper($this->dataMapper)
  33.         ;
  34.     }
  35.     public function getBlockPrefix(): string
  36.     {
  37.         return 'sylius_cart_item';
  38.     }
  39. }