- <?php
- 
- /*
-  * This file is part of EC-CUBE
-  *
-  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
-  *
-  * http://www.ec-cube.co.jp/
-  *
-  * For the full copyright and license information, please view the LICENSE
-  * file that was distributed with this source code.
-  */
- 
- namespace Customize\Form\Type\Front;
- 
- use Eccube\Common\EccubeConfig;
- use Eccube\Form\Type\Master\PrefType;
- use Eccube\Form\Type\AddressType;
- use Eccube\Form\Type\KanaType;
- use Eccube\Form\Type\NameType;
- use Eccube\Form\Type\PhoneNumberType;
- use Eccube\Form\Type\PostalType;
- use Eccube\Form\Validator\Email;
- use Eccube\Form\Type\Master\SexType;
- use Eccube\Form\Type\Master\JobType;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
- use Symfony\Component\Form\Extension\Core\Type\EmailType;
- use Symfony\Component\Form\Extension\Core\Type\TextareaType;
- use Symfony\Component\Form\Extension\Core\Type\NumberType;
- use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
- use Symfony\Component\Form\Extension\Core\Type\TextType;
- use Symfony\Component\Form\Extension\Core\Type\FileType;
- use Symfony\Component\Form\Extension\Core\Type\CollectionType;
- use Symfony\Component\Form\Extension\Core\Type\HiddenType;
- use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
- use Symfony\Component\Form\Extension\Core\Type\DateType;
- use Symfony\Component\Form\FormEvent;
- use Symfony\Component\Form\FormEvents;
- use Symfony\Bridge\Doctrine\Form\Type\EntityType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\Validator\Constraints as Assert;
- 
- use Eccube\Repository\ProductRepository;
- use Eccube\Repository\CategoryRepository;
- 
- use Customize\Service\FileUploader;
- 
- class LoanType extends AbstractType
- {
-     /**
-      * @var EccubeConfig
-      */
-     protected $eccubeConfig;
- 
-     /**
-      * @var FileUploader
-      */
-     protected $fileUploader;
- 
-     protected $productRepository;
-     protected $categoryRepository;
- 
-     /**
-      * ContactType constructor.
-      *
-      * @param EccubeConfig $eccubeConfig
-      */
-     public function __construct(
-         CategoryRepository $categoryRepository,
-         ProductRepository $productRepository,
-         EccubeConfig $eccubeConfig,
-         FileUploader $fileUploader) {
-         $this->categoryRepository = $categoryRepository;
-         $this->productRepository = $productRepository;
-         $this->eccubeConfig = $eccubeConfig;
-         $this->fileUploader = $fileUploader;
-     }
-     /**
-      * {@inheritdoc}
-      */
-     public function buildForm(FormBuilderInterface $builder, array $options)
-     {
-         // 【ご本人様について】
-         $builder
-             // お名前
-             ->add('name', NameType::class, [
-                 'required' => true,
-             ])
-             // フリガナ
-             ->add('kana', KanaType::class, [
-                 'required' => true,
-             ])
-             // 性別
-             ->add('sex', SexType::class, [
-                 'required' => true,
-             ])
-             // 生年月日
-             ->add('birth', BirthdayType::class, [
-                 'required' => true,
-                 'input' => 'datetime',
-                 'years' => range(date('Y'), date('Y') - $this->eccubeConfig['eccube_birth_max']),
-                 'widget' => 'choice',
-                 'placeholder' => ['year' => '----', 'month' => '--', 'day' => '--'],
-                 'constraints' => [
-                     new Assert\LessThanOrEqual([
-                         'value' => date('Y-m-d', strtotime('-1 day')),
-                         'message' => 'form_error.select_is_future_or_now_date',
-                     ]),
-                 ],
-             ])
-             // 郵便番号
-             ->add('postal_code', PostalType::class, [
-                 'required' => true,
-             ])
-             // 住所
-             ->add('address', AddressType::class, [
-                 'required' => true,
-             ])
-             // 電話番号(ご自宅)
-             ->add('tel_number_type', ChoiceType::class, [
-                 'choices'  => [
-                     '自宅' => '自宅',
-                     '呼び出し' => '呼び出し',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 電話番号(ご自宅)
-             ->add('tel_number', PhoneNumberType::class, [
-                 'required' => true,
-             ])
-             // 電話番号(携帯)
-             ->add('phone_number', PhoneNumberType::class, [
-                 'required' => true,
-             ])
-             // メールアドレス
-             ->add('email', EmailType::class, [
-                 'required' => true,
-                 'constraints' => [
-                     // new Assert\NotBlank(),
-                     new Email(null, null, $this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' : null),
-                 ],
-             ])
-             // 配偶者
-             ->add('spouse', ChoiceType::class, [
-                 'choices'  => [
-                     '有り' => '有り',
-                     '無し' => '無し',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 配偶者の職業
-             ->add('spouse_job', ChoiceType::class, [
-                 'choices'  => [
-                     '選択してください' => '',
-                     '公務員' => '公務員',
-                     '公的資格者' => '公的資格者',
-                     '会社員(内勤)' => '会社員(内勤)',
-                     '会社員(外勤)' => '会社員(外勤)',
-                     '自営業' => '自営業',
-                     '自由業' => '自由業',
-                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
-                     'なし' => 'なし',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 世帯主とのご関係
-             ->add('relationship', ChoiceType::class, [
-                 'choices'  => [
-                     '本人' => '本人',
-                     '配偶者' => '配偶者',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 世帯主とのご関係
-             ->add('relationship_other', TextType::class, [
-                 'required' => false,
-             ])
-             // 世帯人数
-             ->add('people_cnt', TextType::class, [
-                 'required' => true,
-             ])
-             // 住宅ローン/家賃支払い
-             ->add('housing_loan', ChoiceType::class, [
-                 'choices'  => [
-                     '有り' => '有り',
-                     '無し' => '無し',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 住居区分
-             ->add('housing_type', ChoiceType::class, [
-                 'choices'  => [
-                     '選択してください' => '',
-                     '自己所有' => '自己所有',
-                     '家族所有' => '家族所有',
-                     '社宅・官舎' => '社宅・官舎',
-                     '借家' => '借家',
-                     '賃貸マンション' => '賃貸マンション',
-                     '公営・公団' => '公営・公団',
-                     'アパート' => 'アパート',
-                     '寮' => '寮',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 居住年数(年)
-             ->add('residence_year', TextType::class, [
-                 'required' => true,
-             ])
-             // 居住年数(月)
-             ->add('residence_month', TextType::class, [
-                 'required' => true,
-             ])
-             ->add('job', ChoiceType::class, [
-                 'choices'  => [
-                     '選択してください' => '',
-                     '公務員' => '公務員',
-                     '公的資格者' => '公的資格者',
-                     // '会社員(内勤)' => '会社員(内勤)',
-                     // '会社員(外勤)' => '会社員(外勤)',
-                     '会社員' => '会社員',
-                     '自営業' => '自営業',
-                     '自由業' => '自由業',
-                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 世帯主との居住状況
-             ->add('head_of_household', ChoiceType::class, [
-                 'choices'  => [
-                     '同居' => '同居',
-                     '別居' => '別居',
-                     '本人のみ' => '本人のみ',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-         ;
- 
- 
-         // 【お勤め先・ご収入について】
-         $builder
-             // 職種
-             // ->add('employed_job', JobType::class, [
-             //     'required' => true,
-             // ])
-             ->add('employed_job', ChoiceType::class, [
-                 'choices'  => [
-                     '選択してください' => '',
-                     '公務員' => '公務員',
-                     '公的資格者' => '公的資格者',
-                     // '会社員(内勤)' => '会社員(内勤)',
-                     // '会社員(外勤)' => '会社員(外勤)',
-                     '会社員' => '会社員',
-                     '自営業' => '自営業',
-                     '自由業' => '自由業',
-                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 業種
-             ->add('employed_industry', ChoiceType::class, [
-                 'choices'  => [
-                     '選択してください' => '',
-                     '公務員' => '公務員',
-                     '公的資格者' => '公的資格者',
-                     '一次産業' => '一次産業',
-                     '鉱業' => '鉱業',
-                     '土木・建築' => '土木・建築',
-                     '不動産' => '不動産',
-                     '金融' => '金融',
-                     '運輸・倉庫' => '運輸・倉庫',
-                     '製造' => '製造',
-                     '卸' => '卸',
-                     '小売' => '小売',
-                     '情報・通信' => '情報・通信',
-                     '旅行宿泊' => '旅行宿泊',
-                     'その他サービス' => 'その他サービス',
-                     '医療機関' => '医療機関',
-                     '組合団体' => '組合団体',
-                     '施設・期間' => '施設・期間',
-                     '個人業' => '個人業',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // お勤め先(派遣元)
-             ->add('employed_company', TextType::class, [
-                 'required' => true,
-             ])
-             // お勤め先フリガナ
-             ->add('employed_company_kana', TextType::class, [
-                 'required' => true,
-             ])
-             // お勤め先住所 郵便番号
-             ->add('employed_postal_code', PostalType::class, [
-                 'required' => true,
-             ])
-             // お勤め先住所
-             // ->add('employed_address', AddressType::class, [
-             //     'required' => true,
-             // ])
-             ->add('employed_address_pref', PrefType::class, [
-                 'required' => true,
-             ])
-             ->add('employed_address_addr01', TextType::class, [
-                 'required' => true,
-             ])
-             ->add('employed_address_addr02', TextType::class, [
-                 'required' => false,
-             ])
-             // お勤め先電話番号
-             ->add('employed_phone_number', PhoneNumberType::class, [
-                 'required' => true,
-             ])
-             // 勤続年数(年)
-             ->add('employed_year', TextType::class, [
-                 'required' => true,
-             ])
-             // 勤続年数(月)
-             ->add('employed_month', TextType::class, [
-                 'required' => true,
-             ])
-             // 税込年収
-             ->add('employed_income', TextType::class, [
-                 'required' => true,
-             ])
-             // 従業員数
-             ->add('employed_cnt', ChoiceType::class, [
-                 'choices'  => [
-                     '10人未満' => '10人未満', //TODO: ???
-                     '10人以上20人未満' => '10人以上20人未満',
-                     '20人以上' => '20人以上'
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 出向先・派遣先電話番号
-             ->add('employed_company_phone_number', PhoneNumberType::class, [
-                 'required' => false,
-             ])
-         ;
- 
- 
-         // 【主婦・年金受給者の方】
-         $builder
-             // 世帯主お名前
-             ->add('pensioner_name', NameType::class, [
-                 'required' => true,
-             ])
-             // フリガナ
-             ->add('pensioner_kana', KanaType::class, [
-                 'required' => true,
-             ])
-             // 世帯主税込年収
-             ->add('pensioner_income', TextType::class, [
-                 'required' => true,
-             ])
-             // 世帯主のお支払中の クレジット返済額
-             ->add('household_paying', ChoiceType::class, [
-                 'choices'  => [
-                     '有り' => '有り',
-                     '無し' => '無し',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 世帯主のお支払中の クレジット返済額
-             ->add('household_paying_amount', TextType::class, [
-                 'required' => true,
-             ])
-             // 年金の種類
-             ->add('pensioner_type', ChoiceType::class, [
-                 'choices'  => [
-                     '国民' => '国民',
-                     '厚生' => '厚生',
-                     '共済' => '共済',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => true,
-                 'multiple' => true,
-                 'required' => true,
-             ])
-             // 年金の種類
-             ->add('pensioner_type_other', TextType::class, [
-                 'required' => false,
-             ])
-             // 年金以外の収入
-             ->add('pensioner_income_other', ChoiceType::class, [
-                 'choices'  => [
-                     '有り' => '有り',
-                     '無し' => '無し',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 今回のお支払い
-             ->add('pensioner_payment', ChoiceType::class, [
-                 'choices'  => [
-                     '年金' => '年金',
-                     '不動産収入' => '不動産収入',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => true,
-                 'multiple' => true,
-                 'required' => true,
-             ])
-             // 今回のお支払い
-             ->add('pensioner_payment_other', TextType::class, [
-                 'required' => false,
-             ])
-             // お勤め先電話番号
-             ->add('pensioner_company_phone_number', PhoneNumberType::class, [
-                 'required' => true,
-             ])
-             // 年金受給者の税込年収
-             ->add('pensioner_income2', TextType::class, [
-                 'required' => true,
-             ])
-             // 口座名義人
-             ->add('pensioner_acount', ChoiceType::class, [
-                 'choices'  => [
-                     '申込者' => '申込者',
-                     '申込者以外' => '申込者以外',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-         ;
- 
- 
-         // 【連帯保証人の方】
-         $builder
-             // お名前
-             ->add('guarantor_name', NameType::class, [
-                 'required' => true,
-             ])
-             // フリガナ
-             ->add('guarantor_kana', KanaType::class, [
-                 'required' => true,
-             ])
-             // 性別
-             ->add('guarantor_sex', SexType::class, [
-                 'required' => true,
-             ])
-             // 生年月日
-             ->add('guarantor_birth', BirthdayType::class, [
-                 'required' => true,
-                 'input' => 'datetime',
-                 'years' => range(date('Y'), date('Y') - $this->eccubeConfig['eccube_birth_max']),
-                 'widget' => 'choice',
-                 'placeholder' => ['year' => '----', 'month' => '--', 'day' => '--'],
-                 'constraints' => [
-                     new Assert\LessThanOrEqual([
-                         'value' => date('Y-m-d', strtotime('-1 day')),
-                         'message' => 'form_error.select_is_future_or_now_date',
-                     ]),
-                 ],
-             ])
-             // 郵便番号
-             ->add('guarantor_postal_code', PostalType::class, [
-                 'required' => true,
-             ])
-             // 住所
-             // ->add('guarantor_address', AddressType::class, [
-             //     'required' => true,
-             // ])
-             ->add('guarantor_address_pref', PrefType::class, [
-                 'required' => true,
-             ])
-             ->add('guarantor_address_addr01', TextType::class, [
-                 'required' => true,
-             ])
-             ->add('guarantor_address_addr02', TextType::class, [
-                 'required' => false,
-             ])
-             // // 電話番号(ご自宅)
-             // ->add('guarantor_tel_number_type', ChoiceType::class, [
-             //     'choices'  => [
-             //         '自宅' => '自宅',
-             //         '呼び出し' => '呼び出し',
-             //     ],
-             //     'expanded' => true,
-             //     'multiple' => false,
-             //     'required' => true,
-             // ])
-             // // 電話番号(ご自宅)
-             // ->add('guarantor_tel_number', PhoneNumberType::class, [
-             //     'required' => true,
-             // ])
-             // 電話番号
-             ->add('guarantor_phone_number', PhoneNumberType::class, [
-                 'required' => true,
-             ])
-             // メールアドレス (半角英数字)
-             ->add('guarantor_email', EmailType::class, [
-                 'required' => true,
-                 'constraints' => [
-                     // new Assert\NotBlank(),
-                     new Email(null, null, $this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' : null),
-                 ],
-             ])
-             // メールアドレス確認用 (半角英数字)
-             ->add('guarantor_email_confirm', EmailType::class, [
-                 'required' => true,
-                 'constraints' => [
-                     // new Assert\NotBlank(),
-                     new Email(null, null, $this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' : null),
-                 ],
-             ])
-             // 契約者との続柄
-             ->add('guarantor_relation', TextType::class, [
-                 'required' => true,
-             ])
-             // 職業
-             // ->add('guarantor_job', JobType::class, [
-             //     'required' => true,
-             // ])
-             ->add('guarantor_job', ChoiceType::class, [
-                 'choices'  => [
-                     '選択してください' => '',
-                     '公務員' => '公務員',
-                     '公的資格者' => '公的資格者',
-                     // '会社員(内勤)' => '会社員(内勤)',
-                     // '会社員(外勤)' => '会社員(外勤)',
-                     '会社員' => '会社員',
-                     '自営業' => '自営業',
-                     '自由業' => '自由業',
-                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 業種
-             ->add('guarantor_industry', ChoiceType::class, [
-                 'choices'  => [
-                     '選択してください' => '',
-                     '公務員' => '公務員',
-                     '公的資格者' => '公的資格者',
-                     '一次産業' => '一次産業',
-                     '鉱業' => '鉱業',
-                     '土木・建築' => '土木・建築',
-                     '不動産' => '不動産',
-                     '金融' => '金融',
-                     '運輸・倉庫' => '運輸・倉庫',
-                     '製造' => '製造',
-                     '卸' => '卸',
-                     '小売' => '小売',
-                     '情報・通信' => '情報・通信',
-                     '旅行宿泊' => '旅行宿泊',
-                     'その他サービス' => 'その他サービス',
-                     '医療機関' => '医療機関',
-                     '組合団体' => '組合団体',
-                     '施設・期間' => '施設・期間',
-                     '個人業' => '個人業',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // お勤め先(派遣元)
-             ->add('guarantor_company', TextType::class, [
-                 'required' => true,
-             ])
-             // お勤め先フリガナ
-             ->add('guarantor_company_kana', TextType::class, [
-                 'required' => true,
-             ])
-             // お勤め先住所 郵便番号
-             ->add('guarantor_company_postal_code', PostalType::class, [
-                 'required' => true,
-             ])
-             // お勤め先住所
-             // ->add('guarantor_company_address', AddressType::class, [
-             //     'required' => true,
-             // ])
-             ->add('guarantor_company_address_pref', PrefType::class, [
-                 'required' => true,
-             ])
-             ->add('guarantor_company_address_addr01', TextType::class, [
-                 'required' => true,
-             ])
-             ->add('guarantor_company_address_addr02', TextType::class, [
-                 'required' => false,
-             ])
-             // お勤め先電話番号
-             ->add('guarantor_company_phone_number', PhoneNumberType::class, [
-                 'required' => true,
-             ])
-             // 勤続年数(年)
-             ->add('guarantor_year', TextType::class, [
-                 'required' => true,
-             ])
-             // 勤続年数(月)
-             ->add('guarantor_month', TextType::class, [
-                 'required' => true,
-             ])
-             // 税込年収
-             ->add('guarantor_income', TextType::class, [
-                 'required' => true,
-             ])
-             // 従業員数
-             ->add('guarantor_cnt', ChoiceType::class, [
-                 'choices'  => [
-                     '10人未満' => '10人未満', //TODO: ???
-                     '10人以上20人未満' => '10人以上20人未満',
-                     '20人以上' => '20人以上',
-                 ],
-                 'expanded' => false,
-                 'multiple' => false,
-                 'required' => true,
-             ])
-             // 出向先・派遣先電話番号
-             ->add('guarantor_company_phone_number2', PhoneNumberType::class, [
-                 'required' => false,
-             ])
-         ;
- 
- 
-         // 工事項目
-         $builder
-             ->add('express_tickets_price', HiddenType::class, [])
-             ->add('construction_air', HiddenType::class, [])
-             ->add('construction_6', NumberType::class, [])
-             ->add('construction_16', NumberType::class, [])
-             ->add('construction_23', NumberType::class, [])
-             ->add('number_install', HiddenType::class, [])
-             ->add('number_install_price', HiddenType::class, [])
-             ->add('construction_type_07_02_v1_price', HiddenType::class, [])
-             ->add('construction_type_07_03_v2_price', HiddenType::class, [])
-             ->add('construction_type_07_04_v1_price', HiddenType::class, [])
-             ->add('construction_type_07_04_v2_price', HiddenType::class, [])
-             ->add('construction_type_07_04_v3_price', HiddenType::class, [])
-             ->add('elevator_07_price', HiddenType::class, [])
-             ->add('electrical_outlet_07_price', HiddenType::class, [])
-             ->add('electrical_outlet_07_02_price', HiddenType::class, [])
-             ->add('room_size_07_03_v1_price', HiddenType::class, [])
-             ->add('room_size_07_03_v2_price', HiddenType::class, [])
-             ->add('piping_status_07_02_price', HiddenType::class, [])
-             ->add('indoor_cover_07_price', HiddenType::class, [])
-             ->add('outdoor_cover_02_price', HiddenType::class, [])
-             ->add('construction_outdoor_07_price', HiddenType::class, [])
-             ->add('construction_method_07_v1_price', HiddenType::class, [])
-             ->add('construction_method_07_v2_price', HiddenType::class, [])
-             ->add('construction_base_price_1', HiddenType::class, [])
-             ->add('construction_base_price_2', HiddenType::class, [])
-             ->add('construction_base_price_3', HiddenType::class, [])
-             ->add('construction_total_price', HiddenType::class, [])
-             ->add('construction_discount', HiddenType::class, [])
-             ->add('product_total_price', HiddenType::class, [])
- 
- 
-             //希望する工事
-             ->add('desired_construction_work', ChoiceType::class, [
-                 'choices'  => [
-                     'エアコン本体のみ購入の方' => 'エアコン本体のみ購入の方',
-                     'エアコン本体と設置工事をご希望の方' => 'エアコン本体と設置工事をご希望の方',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             //希望する工事 → エアコン本体と設置工事をご希望の方
-             ->add('desired_construction_work_02', ChoiceType::class, [
-                 'choices'  => [
-                     '最終金額算出' => '最終金額算出',
-                     '新居等への引越しのため設置場所の詳細確認不可' => '新居等への引越しのため設置場所の詳細確認不可',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 特急券の購入
-             ->add('express_tickets', ChoiceType::class, [
-                 'choices'  => [
-                     'する' => 'する',
-                     'しない' => 'しない',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === 'する') {
-                         return ['price' => 5500];
-                     } elseif ($choice === 'しない') {
-                         return ['price' => 0];
-                     }
-                     return [];
-                 },
-             ])
-             // お住まい
-             ->add('osumai', ChoiceType::class, [
-                 'choices'  => [
-                     '一戸建て' => '一戸建て',
-                     '集合住宅' => '集合住宅',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 建物の所有
-             ->add('building_ownership', ChoiceType::class, [
-                 'choices'  => [
-                     '持ち家' => '持ち家',
-                     '賃貸' => '賃貸',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 構造
-             ->add('structure', ChoiceType::class, [
-                 'choices'  => [
-                     '木造' => '木造',
-                     '鉄骨' => '鉄骨',
-                     'コンクリート(RC)' => 'コンクリート(RC)',
-                     'その他' => 'その他',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // // 設置台数
-             // ->add('number_install', ChoiceType::class, [
-             //     'choices'  => [
-             //         '1台' => '1台',
-             //         '2台' => '2台',
-             //         '3台' => '3台',
-             //         '4台以上' => '4台以上',
-             //     ],
-             //     'expanded' => true,
-             //     'multiple' => false,
-             //     'required' => false,
-             //     'choice_attr' => function($choice, $key, $value) {
-             //         if ($choice === '1台') {
-             //             return ['percent' => 0];
-             //         } elseif ($choice === '2台') {
-             //             return ['percent' => 0.05];
-             //         } elseif ($choice === '3台') {
-             //             return ['percent' => 0.1];
-             //         } elseif ($choice === '4台以上') {
-             //             return ['percent' => 0.15];
-             //         }
-             //         return [];
-             //     },
-             // ])            
-             //工事希望日1
-             ->add('construction_date_1', DateType::class, [
-                 'required' => false,
-                 'input' => 'datetime',
-                 'widget' => 'single_text',
-                 'placeholder' => ['year' => '----', 'month' => '--', 'day' => '--'],
-             ])
-             //工事希望日2
-             ->add('construction_date_2', DateType::class, [
-                 'required' => false,
-                 'input' => 'datetime',
-                 'widget' => 'single_text',
-                 'placeholder' => ['year' => '----', 'month' => '--', 'day' => '--'],
-             ])
-             //工事希望日3
-             ->add('construction_date_3', DateType::class, [
-                 'required' => false,
-                 'input' => 'datetime',
-                 'widget' => 'single_text',
-                 'placeholder' => ['year' => '----', 'month' => '--', 'day' => '--'],
-             ])
-             // 希望時間帯_1
-             ->add('time_slot_1', ChoiceType::class, [
-                 'choices'  => [
-                     '午前' => '午前',
-                     '午後' => '午後',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 希望時間帯_2
-             ->add('time_slot_2', ChoiceType::class, [
-                 'choices'  => [
-                     '午前' => '午前',
-                     '午後' => '午後',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 希望時間帯_3
-             ->add('time_slot_3', ChoiceType::class, [
-                 'choices'  => [
-                     '午前' => '午前',
-                     '午後' => '午後',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             //その他希望
-             ->add('contents', TextareaType::class, [
-                 'required' => false,
-                 'constraints' => [
-                     // new Assert\NotBlank(),
-                     new Assert\Length([
-                         'max' => $this->eccubeConfig['eccube_lltext_len'],
-                     ])
-                 ],
-             ])
-             // 工事内訳
-             ->add('construction_type_07', ChoiceType::class, [
-                 'choices'  => [
-                     '新設' => '新設',
-                     '交換' => '交換',
-                     '新設工事に加えて移設工事も希望' => '新設工事に加えて移設工事も希望',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 工事内訳 → 交換
-             ->add('construction_type_07_02_v1', ChoiceType::class, [
-                 'choices'  => [
-                     '処分を希望する(リサイクル&収集運搬費)' => '処分を希望する(リサイクル&収集運搬費)',
-                     '処分を希望しない' => '処分を希望しない',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '処分を希望する(リサイクル&収集運搬費)') {
-                         return ['price' => 7180];
-                     } elseif ($choice === '処分を希望しない') {
-                         return ['price' => 5980];
-                     }
-                     return [];
-                 },
-             ])
-             // 工事内訳 → 新設工事に加えて移設工事も希望
-             ->add('construction_type_07_02_v2', ChoiceType::class, [
-                 'choices'  => [
-                     '分解洗浄を希望する' => '分解洗浄を希望する',
-                     '分解洗浄を希望しない' => '分解洗浄を希望しない',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する
-             ->add('construction_type_07_03_v1', ChoiceType::class, [
-                 'choices'  => [
-                     '移設6~14畳(取外し含む)' => '移設6~14畳(取外し含む)',
-                     '移設16~20畳(取外し含む)' => '移設16~20畳(取外し含む)',
-                     '移設23畳~(取外し含む)' => '移設23畳~(取外し含む)',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望しない
-             ->add('construction_type_07_03_v2', ChoiceType::class, [
-                 'choices'  => [
-                     '移設6~14畳(取外し含む)' => '移設6~14畳(取外し含む)',
-                     '移設16~20畳(取外し含む)' => '移設16~20畳(取外し含む)',
-                     '移設23畳~(取外し含む)' => '移設23畳~(取外し含む)',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '移設6~14畳(取外し含む)') {
-                         return ['price' => 24980];
-                     } elseif ($choice === '移設16~20畳(取外し含む)') {
-                         return ['price' => 28980];
-                     } elseif ($choice === '移設23畳~(取外し含む)') {
-                         return ['price' => 32980];
-                     }
-                     return [];
-                 },
-             ])
-             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する → 移設6~14畳(取外し含む)
-             ->add('construction_type_07_04_v1', ChoiceType::class, [
-                 'choices'  => [
-                     '掃除機能付き' => '掃除機能付き',
-                     '掃除機能なし' => '掃除機能なし',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '掃除機能付き') {
-                         return ['price' => 50980];
-                     } elseif ($choice === '掃除機能なし') {
-                         return ['price' => 47980];
-                     }
-                     return [];
-                 },
-             ])
-             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する → 移設16~20畳(取外し含む)
-             ->add('construction_type_07_04_v2', ChoiceType::class, [
-                 'choices'  => [
-                     '掃除機能付き' => '掃除機能付き',
-                     '掃除機能なし' => '掃除機能なし',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '掃除機能付き') {
-                         return ['price' => 54980];
-                     } elseif ($choice === '掃除機能なし') {
-                         return ['price' => 51980];
-                     }
-                     return [];
-                 },
-             ])
-             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する → 移設23畳~(取外し含む)
-             ->add('construction_type_07_04_v3', ChoiceType::class, [
-                 'choices'  => [
-                     '掃除機能付き' => '掃除機能付き',
-                     '掃除機能なし' => '掃除機能なし',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '掃除機能付き') {
-                         return ['price' => 58980];
-                     } elseif ($choice === '掃除機能なし') {
-                         return ['price' => 55980];
-                     }
-                     return [];
-                 },
-             ])
-             // エアコン設置場所
-             ->add('construction_floor_07', ChoiceType::class, [
-                 'choices'  => [
-                     '1階' => '1階',
-                     '2階' => '2階',
-                     '3階' => '3階',
-                     '4階以上' => '4階以上',
-                     '未定' => '未定',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // エレベーターの有無
-             ->add('elevator_07', ChoiceType::class, [
-                 'choices'  => [
-                     'あり' => 'あり',
-                     'なし(新設)' => 'なし(新設)',
-                     'なし(交換)' => 'なし(交換)',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === 'あり') {
-                         return ['price' => 0];
-                     } elseif ($choice === 'なし(新設)') {
-                         return ['price' => 5980];
-                     } elseif ($choice === 'なし(交換)') {
-                         return ['price' => 11980];
-                     }
-                     return [];
-                 },
-             ])
-             // コンセントの有無
-             ->add('electrical_outlet_07', ChoiceType::class, [
-                 'choices'  => [
-                     'あり' => 'あり',
-                     'なし(別途工事が必要になります)' => 'なし(別途工事が必要になります)',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === 'なし(別途工事が必要になります)') {
-                         return ['price' => 16980];
-                     }
-                     return [];
-                 },
-             ])
-             // コンセントの有無 → あり
-             ->add('electrical_outlet_07_02', ChoiceType::class, [
-                 'choices'  => [
-                     '既存コンセントの延長の有' => '既存コンセントの延長の有',
-                     '既存コンセントの延長の無' => '既存コンセントの延長の無',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '既存コンセントの延長の有') {
-                         return ['price' => 3980];
-                     } elseif ($choice === '既存コンセントの延長の無') {
-                         return ['price' => 0];
-                     }
-                     return [];
-                 },
-             ])
-             // 建物の契約アンペア
-             ->add('contract_amp', ChoiceType::class, [
-                 'choices'  => [
-                     '30A' => '30A',
-                     '40A' => '40A',
-                     '50A' => '50A',
-                     '50A以上' => '50A以上',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // コンセントアース端子
-             ->add('outlet_earth', ChoiceType::class, [
-                 'choices'  => [
-                     'あり' => 'あり',
-                     'なし' => 'なし',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 配管穴の有無
-             ->add('room_size_07', ChoiceType::class, [
-                 'choices'  => [
-                     'あり' => 'あり',
-                     'なし' => 'なし',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 配管穴の有無 → なし
-             ->add('room_size_07_02', ChoiceType::class, [
-                 'choices'  => [
-                     '建物が2009年6月以降に着工した証明書あり' => '建物が2009年6月以降に着工した証明書あり',
-                     '建物が2009年6月以降に着工した証明書なし' => '建物が2009年6月以降に着工した証明書なし',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 配管穴の有無 → なし → 建物が2009年6月以降に着工した証明書あり
-             ->add('room_size_07_03_v1', ChoiceType::class, [
-                 'choices'  => [
-                     '木造' => '木造',
-                     'コンクリート' => 'コンクリート',
-                     '鉄骨系(ALC)' => '鉄骨系(ALC)',
-                     'その他' => 'その他',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '木造') {
-                         return ['price' => 7980];
-                     } elseif ($choice === 'コンクリート') {
-                         return ['price' => 39980];
-                     } elseif ($choice === '鉄骨系(ALC)') {
-                         return ['price' => 7980];
-                     }
-                     return [];
-                 },
-             ])
-             // 配管穴の有無 → なし → 建物が2009年6月以降に着工した証明書なし
-             ->add('room_size_07_03_v2', ChoiceType::class, [
-                 'choices'  => [
-                     '木造' => '木造',
-                     'コンクリート' => 'コンクリート',
-                     '鉄骨系(ALC)' => '鉄骨系(ALC)',
-                     'その他' => 'その他',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' => function($choice, $key, $value) {
-                     if ($choice === '木造') {
-                         return ['price' => 34980];
-                     } elseif ($choice === 'コンクリート') {
-                         return ['price' => 74980];
-                     } elseif ($choice === '鉄骨系(ALC)') {
-                         return ['price' => 34980];
-                     }
-                     return [];
-                 },
-             ])
-             //設置予定場所の配管の状態
-             ->add('piping_status_07', ChoiceType::class, [
-                 'choices'  => [
-                     '通常配管' => '通常配管',
-                     '隠蔽配管' => '隠蔽配管',
-                     '不明' => '不明',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 設置予定場所の配管の状態 → 隠蔽配管
-             ->add('piping_status_07_02', ChoiceType::class, [
-                 'choices'  => [
-                     '新設' => '新設',
-                     '交換(再使用接続・洗浄費含む)' => '交換(再使用接続・洗浄費含む)',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' =>  function($choice, $key, $value) {
-                     if ($choice === '新設') {
-                         return ['price' => 9800];
-                     } elseif ($choice === '交換(再使用接続・洗浄費含む)') {
-                         return ['price' => 49800];
-                     }
-                     return [];
-                 },
-             ])
-             //室内化粧カバー
-             ->add('indoor_cover_07', ChoiceType::class, [
-                 'choices'  => [
-                     '必要(2m以内)' => '必要(2m以内)',
-                     '不要' => '不要',
-                     '未定' => '未定',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' =>  function($choice, $key, $value) {
-                     if ($choice === '必要(2m以内)') {
-                         return ['price' => 9980];
-                     }
-                     return [];
-                 },
-             ])
-             // 室外化粧カバー
-             ->add('outdoor_cover', ChoiceType::class, [
-                 'choices'  => [
-                     '必要' => '必要',
-                     '不要' => '不要',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 室外化粧カバー
-             ->add('outdoor_cover_02', ChoiceType::class, [
-                 'choices'  => [
-                     '新規同階' => '新規同階',
-                     '新規異階' => '新規異階',
-                     '再使用(交換)同階' => '再使用(交換)同階',
-                     '再使用(交換)異階' => '再使用(交換)異階',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' =>  function($choice, $key, $value) {
-                     if ($choice === '新規同階') {
-                         return ['price' => 9980];
-                     } elseif ($choice === '新規異階') {
-                         return ['price' => 44960];
-                     } elseif ($choice === '再使用(交換)同階') {
-                         return ['price' => 3380];
-                     } elseif ($choice === '再使用(交換)異階') {
-                         return ['price' => 19880];
-                     }
-                     return [];
-                 },
-             ])
-             // 室外機の設置場所
-             ->add('construction_outdoor_07', ChoiceType::class, [
-                 'choices'  => [
-                     '室内機と同階' => '室内機と同階',
-                     '1階差(室内機2階、室外機1階)' => '1階差(室内機2階、室外機1階)',
-                     '2階差(室内機3階、室外機1階)' => '2階差(室内機3階、室外機1階)',
-                     'その他' => 'その他',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' =>  function($choice, $key, $value) {
-                     if ($choice === '1階差(室内機2階、室外機1階)') {
-                         return ['price' => 33880];
-                     } elseif ($choice === '2階差(室内機3階、室外機1階)') {
-                         return ['price' => 66880];
-                     }
-                     return [];
-                 },
-             ])
-             //設置方法
-             ->add('setting_install_method', ChoiceType::class, [
-                 'choices'  => [
-                     '新規取付' => '新規取付',
-                     '交換' => '交換',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-             ])
-             // 設置方法 → 新規取付
-             ->add('construction_method_07_v1', ChoiceType::class, [
-                 'choices'  => [
-                     '①床置き(基本料金に含まれます)' => '①床置き(基本料金に含まれます)',
-                     '②二段置き' => '②二段置き',
-                     '③壁掛け' => '③壁掛け',
-                     '④屋根置き(屋根に対して垂直)' => '④屋根置き(屋根に対して垂直)',
-                     '⑤屋根置き(屋根に対して水平)' => '⑤屋根置き(屋根に対して水平)',
-                     '⑥公団吊り(天井吊り)' => '⑥公団吊り(天井吊り)',
-                     '⑦サービスバルコニー' => '⑦サービスバルコニー',
-                     '⑧不明(記載)' => '⑧不明(記載)',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' =>  function($choice, $key, $value) {
-                     if ($choice === '②二段置き') {
-                         return ['price' => 29800];
-                     } elseif ($choice === '③壁掛け') {
-                         return ['price' => 17800];
-                     } elseif ($choice === '④屋根置き(屋根に対して垂直)') {
-                         return ['price' => 21980];
-                     } elseif ($choice === '⑤屋根置き(屋根に対して水平)') {
-                         return ['price' => 21980];
-                     } elseif ($choice === '⑥公団吊り(天井吊り)') {
-                         return ['price' => 28800];
-                     } elseif ($choice === '⑦サービスバルコニー') {
-                         return ['price' => 7980];
-                     }
-                     return [];
-                 },
-             ])
-             // 設置方法 → 交換
-             ->add('construction_method_07_v2', ChoiceType::class, [
-                 'choices'  => [
-                     '①床置き(基本料金に含まれます)' => '①床置き(基本料金に含まれます)',
-                     '②二段置き' => '②二段置き',
-                     '③壁掛け' => '③壁掛け',
-                     '④屋根置き(屋根に対して垂直)' => '④屋根置き(屋根に対して垂直)',
-                     '⑤屋根置き(屋根に対して水平)' => '⑤屋根置き(屋根に対して水平)',
-                     '⑥公団吊り(天井吊り)' => '⑥公団吊り(天井吊り)',
-                     '⑦サービスバルコニー' => '⑦サービスバルコニー',
-                     '⑧不明(記載)' => '⑧不明(記載)',
-                 ],
-                 'expanded' => true,
-                 'multiple' => false,
-                 'required' => false,
-                 'choice_attr' =>  function($choice, $key, $value) {
-                     if ($choice === '②二段置き') {
-                         return ['price' => 7280];
-                     } elseif ($choice === '③壁掛け') {
-                         return ['price' => 21800];
-                     } elseif ($choice === '④屋根置き(屋根に対して垂直)') {
-                         return ['price' => 21980];
-                     } elseif ($choice === '⑤屋根置き(屋根に対して水平)') {
-                         return ['price' => 21980];
-                     } elseif ($choice === '⑥公団吊り(天井吊り)') {
-                         return ['price' => 21800];
-                     } elseif ($choice === '⑦サービスバルコニー') {
-                         return ['price' => 7980];
-                     }
-                     return [];
-                 },
-             ])
- 
-             ->add('image_1', FileType::class, [
-                 'multiple' => false,
-                 'required' => false,
-                 'mapped' => false,
-             ])
-             ->add('image_2', FileType::class, [
-                 'multiple' => false,
-                 'required' => false,
-                 'mapped' => false,
-             ])
-             ->add('image_3', FileType::class, [
-                 'multiple' => false,
-                 'required' => false,
-                 'mapped' => false,
-             ])
-             ->add('image_4', FileType::class, [
-                 'multiple' => false,
-                 'required' => false,
-                 'mapped' => false,
-             ])
-             ->add('image_5', FileType::class, [
-                 'multiple' => false,
-                 'required' => false,
-                 'mapped' => false,
-             ])
-             ->add('image_reason', FileType::class, [
-                 'multiple' => false,
-                 'required' => false,
-                 'mapped' => false,
-             ])
-             ->add('filename_image_1', HiddenType::class)
-             ->add('filename_image_2', HiddenType::class)
-             ->add('filename_image_3', HiddenType::class)
-             ->add('filename_image_4', HiddenType::class)
-             ->add('filename_image_5', HiddenType::class)
- 
- 
- 
-             ->add('location', TextType::class, [
-                 'required' => false,
-             ])
-             ->add('floor', FileType::class, [
-                 'multiple' => false,
-                 'required' => false,
-                 'mapped' => false,
-             ])
-             ->add('filename_floor', HiddenType::class)
-         ;
- 
-         $builder->get('address')->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
-             $form = $event->getForm();
- 
-             $form->add('addr02', \Symfony\Component\Form\Extension\Core\Type\TextType::class, [
-                 'required' => false,
-             ]);
-         });
- 
- 
- 
-         // 自社ローン商品を取得
-         $constructionItems = array();
-         $constructionTatamis = array();
- 
-         $Category = $this->categoryRepository->find(118);
-         foreach ($Category->getProductCategories() as $productCategorie) {
-             $product = $productCategorie->getProduct();
-             $productId = $product->getId();
-             $productName = $product->getName();
- 
-             $constructionItems[$productId] = $productName;
-             $constructionTatamis[$productId]['data-loan'] = 1;
-             $constructionTatamis[$productId]['data-price'] = $product->getPrice02IncTaxMin();
-             $constructionTatamis[$productId]['data-quantity'] = 1;
- 
-             foreach ($product->getProductCategories() as $ProductCategories) {
-                 $categoryName = $ProductCategories->getCategory()->getName();
- 
-                 if (mb_strpos($categoryName, "畳") !== false) {
-                     $constructionItems[$productId] = $productName . " {$categoryName}";
-                     $constructionTatamis[$productId]['data-tatami'] = str_replace("畳", "", $categoryName);
-                 }
-             }
-         }       
- 
-         $builder->add('construction_airs', ChoiceType::class, [
-             'choices'  => $constructionItems,
-             'expanded' => true,
-             'multiple' => true,
-             'required' => false,
-             'choice_attr' =>  function($choice, $key, $value) use ($constructionTatamis){   
-                 return empty($constructionTatamis[$key]) ? [] : $constructionTatamis[$key];
-             },
-         ]);
- 
- 
- 
-         /**
-          * SUBMIT前にファイルをアップロードしてfilenameにセットする
-          */
-         $builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) {
-             $data = $event->getData();
- 
-             // ファイルをアップロード
-             if (!empty($data['image_1'])) {
-                 $filename = $this->fileUploader->upload($data['image_1'], 'construction');
-                 $data['filename_image_1'] = $filename;
-                 unset($data['image_1']);
-             }
-             if (!empty($data['image_2'])) {
-                 $filename = $this->fileUploader->upload($data['image_2'], 'construction');
-                 $data['filename_image_2'] = $filename;
-                 unset($data['image_2']);
-             }
-             if (!empty($data['image_3'])) {
-                 $filename = $this->fileUploader->upload($data['image_3'], 'construction');
-                 $data['filename_image_3'] = $filename;
-                 unset($data['image_3']);
-             }
-             if (!empty($data['image_4'])) {
-                 $filename = $this->fileUploader->upload($data['image_4'], 'construction');
-                 $data['filename_image_4'] = $filename;
-                 unset($data['image_4']);
-             }
-             if (!empty($data['image_5'])) {
-                 $filename = $this->fileUploader->upload($data['image_5'], 'construction');
-                 $data['filename_image_5'] = $filename;
-                 unset($data['image_5']);
-             }
- 
-             if (!empty($data['floor'])) {
-                 $filename = $this->fileUploader->upload($data['floor'], 'construction');
-                 $data['filename_floor'] = $filename;
-                 unset($data['floor']);
-             }
- 
-             // アップロードしたデータを保存
-             $event->setData($data);
-         });
-     }
- 
-     /**
-      * {@inheritdoc}
-      */
-     public function getBlockPrefix()
-     {
-         return 'loan';
-     }
- }
-