質問 > フロント機能 > Admin\ShippingType.php; を拡張したいのですがエラーが出ます。 |
フロント機能
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
hashida |
投稿日時: 2021/6/29 14:35
対応状況: 開発中
|
半人前 登録日: 2021/6/25 居住地: 投稿: 28 |
Admin\ShippingType.php; を拡張したいのですがエラーが出ます。 ▼テンプレート
[EC-CUBE] EC-CUBEのバージョン 4.0.5、新規インストール [OS] docker windows [PHP] 7.4 [データベース] SQLite [カスタマイズの有無] 受注登録の配送情報にデフォルトの値を入れたいと思いEccube\Form\Type\Admin\ShippingType.phpを拡張しました。 [ShippingFormExtension.php] <?php namespace Customize\Form\Extension; use Eccube\Form\Type\AddressType; use Eccube\Form\Type\Admin\ShippingType; use Eccube\Form\Type\KanaType; use Eccube\Form\Type\NameType; use Eccube\Form\Type\PhoneNumberType; use Eccube\Form\Type\PostalType; use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\FormBuilderInterface; class ShippingFormExtension extends AbstractTypeExtension { public function getExtendedType(): string { return ShippingType::class; } /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options): void { $this->takeoutdataInput($builder); } private function takeoutdataInput(FormBuilderInterface $builder): void { $fieldNames = [ 'name' => NameType::class, 'postal_code' => PostalType::class, 'address' => AddressType::class, 'kana' => KanaType::class, 'phone_number' => PhoneNumberType::class, ]; foreach ($fieldNames as $fieldName => $type) { $field = $builder->get($fieldName); $options = $field->getOptions(); if($fieldName == 'postal_code'||$fieldName == 'phone_number'){ $options['empty_data'] = 0000000; }elseif($fieldName == 'address'){ $options['pref_options']['data'] = "データ"; $options['addr01_options']['data'] = "データ"; $options['addr02_options']['data'] = "データ"; }else{ $options['empty_data'] = 'データ'; } $builder->add($fieldName, $type, $options); } } } [現象] Warning: spl_object_hash() expects parameter 1 to be object, string given というエラーが発生してしまいました。 以下が発生源だと提示されております。 Form->createView() in Eccube/Controller/Admin/Order/EditController.php (line 398) $times[$Delivery->getId()][$DeliveryTime->getId()] = $DeliveryTime->getDeliveryTime(); } } return [ 'form' => $form->createView(), 'searchCustomerModalForm' => $searchCustomerModalForm->createView(), 'searchProductModalForm' => $searchProductModalForm->createView(), 'Order' => $TargetOrder, 'id' => $id, 'shippingDeliveryTimes' => $this->serializer->serialize($times, 'json'), なにをどうすればよいかご教授いただけないでしょうか。 何卒宜しくお願い致します。 |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
» Admin\ShippingType.php; を拡張したいのですがエラーが出ます。 | hashida | 2021/6/29 14:35 |