バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > meta.twigでrouteが存在せずRuntimeError

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
brass
投稿日時: 2023/3/30 14:07
対応状況: −−−
半人前
登録日: 2019/8/30
居住地:
投稿: 11
meta.twigでrouteが存在せずRuntimeError
EC-CUBE 4.2.1
DBサーバー MySQL 5.7.40
WEBサーバー Apache/2.4.54 (Unix) OpenSSL/1.1.1s PHP/7.3.33
PHP 8.1.13

[導入プラグインの有無] デフォルト以外なし

[カスタマイズの有無] messages.ja.yamlの追加・変更

[現象]
ECCUBE_USER_DATA_ROUTEを指定したのち、ページを新規追加しました。
.env

〜上記省略〜
ECCUBE_USER_DATA_ROUTE=hogehoge
〜下記省略〜


作成したページにアクセスしたところ、meta.twigのrouteの部分でRuntimeErrorが発生しました。
当該コードをコメントアウトすると解消され、新たなエラーは発生しません。
同じような症状が発現した方はいらっしゃいますか?
何か情報をお持ちの方がいらっしゃいましたら、投稿していただけますと幸いです。

An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "hogehoge" as such route does not exist.").


Twig\Error\
RuntimeError
in app/template/hogehoge/meta.twig (line 23)

〜上記省略〜
{% elseif Page is defined and Page.edit_type == 0 and Page.url is defined %}
   {% set meta_canonical = url(eccube_config.eccube_user_data_route, {'route': Page.url}) %}
{% endif %}
〜下記省略〜
mcontact
投稿日時: 2023/3/30 18:09
対応状況: −−−
登録日: 2022/1/22
居住地:
投稿: 1265
Re: meta.twigでrouteが存在せずRuntimeError
EC-CUBEのログは確認できますか?
どのようなエラーが出ますでしょうか?
var/log/prod/site-yyyy-mm-dd.log に「システムエラーが発生しました」といった行がありましたらご提示ください。


そして、Controller部のRoute設定はどの様に記載していますか?


----------------
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EC-CUBEインテグレートパートナー【ゴールド】ランク
M&I Works
URL: https://miworks.biz/
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

brass
投稿日時: 2023/4/3 9:25
対応状況: −−−
半人前
登録日: 2019/8/30
居住地:
投稿: 11
Re: meta.twigでrouteが存在せずRuntimeError
返信遅くなりました。
投稿ありがとうございます。
以下、エラーコードとUserDataControllerになります。
なお、Controllerのカスタマイズは行なっておらず、ECCUBE_USER_DATA_ROUTEのみ変更しています。

___ FRONT __________________________________________________________________________________________
Rollback executed.
--> extra: { url: /略/hoge/略, ip: *******, http_method: GET, server: 10.0.1.10, referrer: null, user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36', file: /中略/src/Eccube/Log/Logger.php, line: 66, class: Eccube\Log\Logger, callType: '->', function: log, uid: *******, user_id: N/A, session_id: ******* }
___ *** CRITICAL ERROR *** ==> REQUEST _____________________________________________________________
Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering
  of a template ("Unable to generate a URL for the named route "hoge" as such route does not
  exist.")." at /中略/meta.twig line 23
--> exception:
      class: Twig\Error\RuntimeError
      message: 'An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "hoge" as such route does not exist.").'
      code: 0
      file: /中略/meta.twig
      line: 23
      trace: 中略
      previous: 中略
___ *** ERROR *** ==> APP __________________________________________________________________________
Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template ("Unable
  to generate a URL for the named route "hoge" as such route does not exist."). (uncaught
  exception) at /中略/meta.twig line 23
--> exception:
      class: Twig\Error\RuntimeError
      message: 'An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "hoge" as such route does not exist.").'
      code: 0
      file: /中略/meta.twig
      line: 23
      trace: 中略
      previous: 中略}


UserDataController
class UserDataController extends AbstractController
{
    /**
     * @var PageRepository
     */
    protected $pageRepository;

    /**
     * @var DeviceTypeRepository
     */
    protected $deviceTypeRepository;

    /**
     * UserDataController constructor.
     *
     * @param PageRepository $pageRepository
     * @param DeviceTypeRepository $deviceTypeRepository
     */
    public function __construct(
        PageRepository $pageRepository,
        DeviceTypeRepository $deviceTypeRepository
    ) {
        $this->pageRepository = $pageRepository;
        $this->deviceTypeRepository = $deviceTypeRepository;
    }

    /**
     * @Route("/%eccube_user_data_route%/{route}", name="user_data", requirements={"route": "([0-9a-zA-Z_\-]+\/?)+(?<!\/)"}, methods={"GET"})
     */
    public function index(Request $request, $route)
    {
        $Page = $this->pageRepository->findOneBy(
            [
                'url' => $route,
                'edit_type' => Page::EDIT_TYPE_USER,
            ]
        );

        if (null === $Page) {
            throw new NotFoundHttpException();
        }

        $file = sprintf('@user_data/%s.twig', $Page->getFileName());

        $event = new EventArgs(
            [
                'Page' => $Page,
                'file' => $file,
            ],
            $request
        );
        $this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_USER_DATA_INDEX_INITIALIZE);

        return $this->render($file);
    }
}
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


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

統計情報

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

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2311
5
umebius
2085
6
yuh
1819
7
h_tanaka
1635
8
red
1569
9
mcontact
1265
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
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.