4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

EC-CUBE4のcontainerの中を探検したときの記録です。

*本記事は、正式な使用法ではありませんので、参考程度にご覧ください。

##containerをゲット
まずはゲットしてみました。

$container = $GLOBALS['kernel']->getContainer();

##containerの中で見つけたもの
こんなのが入っていました。

ログイン中のCustomer
$Customer = $container->get('security.token_storage')->getToken()->getUser();
eccubeConfig
$eccubeConfig = $container->get(\Eccube\Common\EccubeConfig::class);
request
$request = $container->get('request_stack')->getCurrentRequest();
entityManger
$entityManger = $container->get('doctrine.orm.entity_manager');
OrderRepository
$OrderRepository = $container->get(\Eccube\Repository\OrderRepository::class);

なんでも入ってるようです。

その他 いろいろ

ログイン中のCustomerの操作権限の確認
$isGranted = $container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY');
formFactory
$formFactory = $container->get('form.factory');
twig
$twig = $container->get('twig');
paginator
$paginator = $container->get('knp_paginator');

以上です。

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?