src/Eccube/Form/Type/Admin/OrderMailType.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 Eccube\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 OrderMailType 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' => false,
  46.                 'mapped' => false,
  47.                 'query_builder' => function (EntityRepository $er) {
  48.                     return $er->createQueryBuilder('mt')
  49. /*
  50.                         ->andWhere('mt.id = :id')
  51.                         ->setParameter('id', $this->eccubeConfig['eccube_order_mail_template_id'])
  52. */
  53.                         ->orderBy('mt.id''ASC');
  54.                 },
  55.             ])
  56.             ->add('mail_subject'TextType::class, [
  57.                 'required' => true,
  58.                 'constraints' => [
  59.                     new Assert\NotBlank(),
  60.                 ],
  61.             ])
  62.             ->add('tpl_data'TextareaType::class, [
  63.                 'label' => false,
  64.                 'mapped' => false,
  65.                 'required' => false,
  66.                 'constraints' => [
  67.                     new TwigLint(),
  68.                 ],
  69.             ])
  70.         ;
  71.     }
  72.     /**
  73.      * {@inheritdoc}
  74.      */
  75.     public function getBlockPrefix()
  76.     {
  77.         return 'admin_order_mail';
  78.     }
  79. }