バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > その他 > テーブルに列を追加

その他

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
akadota
投稿日時: 2020/10/3 17:38
対応状況: 開発中
半人前
登録日: 2020/8/11
居住地:
投稿: 24
テーブルに列を追加
本当は購入画面で項目を追加したいのですが、試しに下記の項目追加を試しています。
が、エラーが出てよくわかりません。よく他の方がサンプルにされてますが、どうやってエラーを無くしているのでしょうか?

【テーブルに列を追加してControllerからアクセス】
https://qiita.com/ma33588/items/1768e997854884e670e0

1)app/Customize/Entity/ProductTrait.php 追加
2)Proxyクラスの生成
3)app/proxy/entity/Product.php が作成され
4)DBアップデート(phpMyadminで見ると列は追加されていました)
5)app/Customize/Controller/SamplePageController.php 作成
この後EC-CUBE画面でエラー。管理画面にも入れないです。

【エラー内容】
(1/2) InvalidArgumentException
Expected to find class "Customize\Controller\SamplePageController" in file "/***/public_html/ec-test/app/Customize/Controller/SamplePageController.php" while importing services from resource "../../../app/Customize/*", but it was not found! Check the namespace prefix used with the resource.

(2/2) FileLoaderLoadException
Expected to find class "Customize\Controller\SamplePageController" in file "/***/public_html/ec-test/app/Customize/Controller/SamplePageController.php" while importing services from resource "../../../app/Customize/*", but it was not found! Check the namespace prefix used with the resource in /***/public_html/ec-test/app/config/eccube/services.yaml (which is loaded in resource "/***/public_html/ec-test/app/config/eccube/services.yaml").

何が間違っているのでしょうか?

468
投稿日時: 2020/10/4 7:50
対応状況: −−−
登録日: 2008/10/26
居住地:
投稿: 3217
Re: テーブルに列を追加
SamplePageController.phpのnamespaceの記述が間違っているのかもしれません。
パスが正しいか確認してみてください。


----------------
株式会社シロハチ
■ECCUBE2系、3系構築カスタマイズご相談ください。
EC-CUBE3マニュアル
blog

akadota
投稿日時: 2020/10/5 10:39
対応状況: −−−
半人前
登録日: 2020/8/11
居住地:
投稿: 24
Re: テーブルに列を追加
確かに『SamplePageController.php』をサーバーから削除するとEC-CUBEが動きます。namespaceは『namespace Customize\Controller;』となっていますがどこが間違っているのかがわかりません><;

【SamplePageController.phの記述】
namespace Customize\Controller;

use Eccube\Controller\AbstractController;
use Eccube\Entity\BaseInfo;
use Eccube\Entity\Product;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\ProductRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class SamplePageController extends AbstractController
{
/** @var BaseInfo */
protected $baseInfo;

/** @var Product */
protected $productRepository;

/**
* SamplePageController constructor.
* @param BaseInfoRepository $baseInfoRepository
* @param ProductRepository $productRepository
*/
public function __construct(
BaseInfoRepository $baseInfoRepository,
ProductRepository $productRepository
)
{
$this->baseInfo = $baseInfoRepository->get();
$this->productRepository = $productRepository;
}

/**
* @Route("/sample/{id}", name="sample_index")
* @Template("Sample/index.twig")
*/
public function index($id)
{
// $product = $this->entityManager->getRepository('Eccube\Entity\Product')->find($id);
$product = $this->productRepository->find($id);

return [
'shop_name' => $this->baseInfo->getShopName(),
'maker_name' => $product->getMakerName(),
'product_name' => $product->getName(),
];
}
}
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


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.