phlexible / country-context-bundle

phlexible 国家上下文包

安装: 129

依赖项: 1

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

1.3.0 2017-01-30 14:29 UTC

This package is auto-updated.

Last update: 2024-09-08 07:19:46 UTC


README

PhlexibleCountryContextBundle 为 phlexible 添加了对基于国家的内容的支持。

安装

  1. 使用 composer 下载 PhlexibleCountryContextBundle
  2. 启用 Bundle
  3. 配置 PhlexibleCountryContextBundle
  4. 更新您的数据库模式
  5. 清除 symfony 缓存

步骤 1:使用 composer 下载 PhlexibleCountryContextBundle

通过运行以下命令添加 PhlexibleCountryContextBundle

$ php composer.phar require phlexible/country-context-bundle "~1.0.0"

Composer 将将包安装到您的项目目录 vendor/phlexible

步骤 2:启用 Bundle

在内核中启用 Bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Phlexible\Bundle\CountryContextBundle\PhlexibleCountryContextBundle(),
    );
}

步骤 3:配置 PhlexibleCountryContextBundle

现在 Bundle 已启用,您需要配置 PhlexibleCountryContextBundle。将以下配置添加到您的 config.yaml 文件中。

# app/config/config.yaml
phlexible_country_context:
    countries:
        gb:
            continent: eu
            country: gb
            languages:
                en: {locale: en, expose: true}
                
phlexible_tree:
    mediator:
        element_viewable_voter: "phlexible_country_context.element_mediator.country_aware_viewable_voter"
    router:
        url_generator_service: "phlexible_country_context.router.country_aware_url_generator"
        request_matcher_service: "phlexible_country_context.router.country_aware_request_matcher"

步骤 4:更新您的数据库模式

现在 Bundle 已设置,最后您需要更新数据库模式,因为国家上下文包包括需要在您的数据库中安装的实体。

对于 ORM,运行以下命令。

$ php app/console doctrine:schema:update --force

步骤 5:清除 symfony 缓存

如果您使用 prod 环境访问 phlexible 应用程序,请清除缓存

$ php app/console cache:clear --env=prod