app/Customize/Form/Type/Admin/CustomOrderMailType.php line 26

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\Admin;
  13. use Doctrine\ORM\EntityRepository;
  14. use Eccube\Common\EccubeConfig;
  15. use Eccube\Form\Type\Master\MailTemplateType;
  16. use Eccube\Form\Validator\TwigLint;
  17. use Symfony\Component\Form\AbstractType;
  18. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  19. use Symfony\Component\Form\Extension\Core\Type\TextType;
  20. use Symfony\Component\Form\FormBuilderInterface;
  21. use Symfony\Component\Validator\Constraints as Assert;
  22. class CustomOrderMailType extends AbstractType
  23. {
  24.     /**
  25.      * @var EccubeConfig
  26.      */
  27.     protected $eccubeConfig;
  28.     /**
  29.      * MailType constructor.
  30.      *
  31.      * @param EccubeConfig $eccubeConfig
  32.      */
  33.     public function __construct(
  34.         EccubeConfig $eccubeConfig
  35.     ) {
  36.         $this->eccubeConfig $eccubeConfig;
  37.     }
  38.     /**
  39.      * {@inheritdoc}
  40.      */
  41.     public function buildForm(FormBuilderInterface $builder, array $options)
  42.     {
  43.         $builder
  44.             ->add('template'MailTemplateType::class, [
  45.                 'required' => true,
  46.                 'mapped' => false,
  47.                 'placeholder' => false,
  48.                 'query_builder' => function (EntityRepository $er) {
  49.                     return $er->createQueryBuilder('mt')
  50.                         ->andWhere('mt.id in (:ids)')
  51.                         ->setParameter('ids',
  52.                             [1131415161718192021]
  53.                         )
  54.                         ->orderBy('mt.id''ASC');
  55.                 },
  56.             ])
  57.             ->add('mail_subject'TextType::class, [
  58.                 'required' => true,
  59.                 'constraints' => [
  60.                     new Assert\NotBlank(),
  61.                 ],
  62.             ])
  63.             ->add('tpl_data'TextareaType::class, [
  64.                 'label' => false,
  65.                 'mapped' => false,
  66.                 'required' => false,
  67.                 'constraints' => [
  68.                     new TwigLint(),
  69.                 ],
  70.             ])
  71.         ;
  72.     }
  73.     /**
  74.      * {@inheritdoc}
  75.      */
  76.     public function getBlockPrefix()
  77.     {
  78.         return 'admin_order_mail';
  79.     }
  80. }