/**
  * Register service function.
  *
  * @param BaseApplication $app
  */
 public function register(BaseApplication $app)
 {
     // Repository
     $app['orderpdf.repository.order_pdf'] = $app->share(function () use($app) {
         return $app['orm.em']->getRepository('Plugin\\OrderPdf\\Entity\\OrderPdf');
     });
     // Order pdf event
     $app['orderpdf.event.order_pdf'] = $app->share(function () use($app) {
         return new OrderPdf($app);
     });
     // Order pdf legacy event
     $app['orderpdf.event.order_pdf_legacy'] = $app->share(function () use($app) {
         return new OrderPdfLegacy($app);
     });
     // ============================================================
     // コントローラの登録
     // ============================================================
     // 管理画面定義
     $admin = $app['controllers_factory'];
     // 強制SSL
     if ($app['config']['force_ssl'] == Constant::ENABLED) {
         $admin->requireHttps();
     }
     // 帳票の作成
     $admin->match('/plugin/order-pdf', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::index')->bind('plugin_admin_order_pdf');
     // PDFファイルダウンロード
     $admin->post('/plugin/order-pdf/download', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::download')->bind('plugin_admin_order_pdf_download');
     $app->mount('/' . trim($app['config']['admin_route'], '/') . '/', $admin);
     // ============================================================
     // Formの登録
     // ============================================================
     // 型登録
     $app['form.types'] = $app->share($app->extend('form.types', function ($types) use($app) {
         $types[] = new OrderPdfType($app);
         return $types;
     }));
     // -----------------------------
     // サービスの登録
     // -----------------------------
     // 帳票作成
     $app['orderpdf.service.order_pdf'] = $app->share(function () use($app) {
         return new OrderPdfService($app);
     });
     // ============================================================
     // メッセージ登録
     // ============================================================
     $file = __DIR__ . '/../Resource/locale/message.' . $app['locale'] . '.yml';
     if (file_exists($file)) {
         $app['translator']->addResource('yaml', $file, $app['locale']);
     }
     // initialize logger (for 3.0.0 - 3.0.8)
     if (!Version::isSupportMethod()) {
         eccube_log_init($app);
     }
 }
 /**
  * Down method.
  *
  * @param Schema $schema
  */
 public function down(Schema $schema)
 {
     if (Version::isSupportMethod()) {
         $app = Application::getInstance();
         $meta = $this->getMetadata($app['orm.em']);
         $tool = new SchemaTool($app['orm.em']);
         $schemaFromMetadata = $tool->getSchemaFromMetadata($meta);
         // テーブル削除
         foreach ($schemaFromMetadata->getTables() as $table) {
             if ($schema->hasTable($table->getName())) {
                 $schema->dropTable($table->getName());
             }
         }
     } else {
         if ($schema->hasTable(self::TABLE)) {
             $schema->dropTable(self::TABLE);
         }
     }
 }
 /**
  * Check to support new hookpoint.
  *
  * @return bool v3.0.9以降のフックポイントに対応しているか?
  */
 private function supportNewHookPoint()
 {
     return Version::isSupportVersion();
 }
Example #4
0
     * @param array  $context
     */
    function log_debug($message, array $context = array())
    {
        if (isset($GLOBALS['eccube_logger'])) {
            $GLOBALS['eccube_logger']->debug($message, $context);
        }
    }
}
if (function_exists('eccube_log_init') === false) {
    /**
     * Init log function for ec-cube <= 3.0.8.
     *
     * @param object $app
     */
    function eccube_log_init($app)
    {
        if (isset($GLOBALS['eccube_logger'])) {
            return;
        }
        $GLOBALS['eccube_logger'] = $app['monolog'];
        $app['eccube.monolog.factory'] = $app->protect(function ($config) use($app) {
            return $app['monolog'];
        });
    }
}
// 3.0.9以上の場合は初期化処理を行う.
if (Version::isSupportMethod()) {
    $app = \Eccube\Application::getInstance();
    eccube_log_init($app);
}