app/Customize/Form/Type/OrderDetailsBlockType.php line 27

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Customize\Form\Type;
  13. use Eccube\Common\EccubeConfig;
  14. use Symfony\Component\Form\AbstractType;
  15. use Symfony\Component\Form\FormBuilderInterface;
  16. use Symfony\Component\Validator\Constraints\Regex;
  17. use Symfony\Component\Validator\Constraints\Blank;
  18. use Symfony\Component\OptionsResolver\OptionsResolver;
  19. use Symfony\Component\Form\Extension\Core\Type\TextType;
  20. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  21. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  22. use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
  23. class OrderDetailsBlockType extends AbstractType
  24. {
  25.     /**
  26.      * @var EccubeConfig
  27.      */
  28.     protected $eccubeConfig;
  29.     /**
  30.      * EntryProductBlockType constructor.
  31.      *
  32.      * @param EccubeConfig $eccubeConfig
  33.      */
  34.     public function __construct(EccubeConfig $eccubeConfig)
  35.     {
  36.         $this->eccubeConfig $eccubeConfig;
  37.     }
  38.     /**
  39.      * {@inheritdoc}
  40.      */
  41.     public function buildForm(FormBuilderInterface $builder, array $options)
  42.     {
  43.         for ($i 1$i 9$i++) { 
  44.             // code...
  45.             $builder
  46.                 ->add("product_code{$i}"TextType::class, [
  47.                     'required' => false,
  48.                 ])
  49.                 ->add("product_name{$i}"TextType::class, [
  50.                     'required' => false,
  51.                 ])
  52.                 ->add("quantity{$i}"IntegerType::class, [
  53.                     'constraints' => [
  54.                         new Regex(['pattern' => '/^\d+$/']),
  55.                     ],
  56.                 ])
  57.                 ->add("print{$i}"ChoiceType::class, [
  58.                   'choices' => array(
  59.                     '無し' => '無し',
  60.                     '有り' => '有り',
  61.                   ),
  62.                 ])
  63.                 ->add("han{$i}"ChoiceType::class, [
  64.                   'choices' => array(
  65.                     '新規・改版' => '新規・改版',
  66.                     '前回通り' => '前回通り',
  67.                   ),
  68.                 ])
  69.                 ->add("color{$i}"ChoiceType::class, [
  70.                   'choices' => array(
  71.                     '金' => '金',
  72.                     '銀' => '銀',
  73.                     '黒' => '黒',
  74.                     '白' => '白',
  75.                     '赤' => '赤',
  76.                     '紺' => '紺',
  77.                     '黄' => '黄',
  78.                     '緑' => '緑',
  79.                   ),
  80.                 ]);
  81.         }
  82.     }
  83.     /**
  84.      * {@inheritdoc}
  85.      */
  86.     public function getBlockPrefix()
  87.     {
  88.         return 'order_detail_block';
  89.     }
  90. }