バージョン選択

フォーラム

メニュー

オンライン状況

50 人のユーザが現在オンラインです。 (43 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 50
もっと...

サイト内検索

質問 > フロント機能 > 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'),

なにをどうすればよいかご教授いただけないでしょうか。
何卒宜しくお願い致します。
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,288名です
総投稿数は109,688件です

投稿数ランキング

1
seasoft
7365
2
468
3217
3
AMUAMU
2712
4
nanasess
2303
5
umebius
2085
6
yuh
1818
7
h_tanaka
1610
8
red
1567
9
mcontact
1240
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
796
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.