phlexible / country-context-bundle
phlexible 国家上下文包
1.3.0
2017-01-30 14:29 UTC
Requires
- php: >=5.6.0
- phlexible/element-bundle: ^1.3.0
- phlexible/element-renderer-bundle: ^1.3.0
- phlexible/tree-bundle: ^1.3.0
Requires (Dev)
- doctrine/orm: ^2.5
- matthiasnoback/symfony-config-test: ^2.0
- matthiasnoback/symfony-dependency-injection-test: ^1.0
- phlexible/indexer-bundle: ^1.1.2
- phlexible/indexer-page-bundle: ^1.2.0
- phpunit/phpunit: ~5.6
- symfony/http-foundation: ^2.8
- twig/twig: ^1.26
README
PhlexibleCountryContextBundle 为 phlexible 添加了对基于国家的内容的支持。
安装
- 使用 composer 下载 PhlexibleCountryContextBundle
- 启用 Bundle
- 配置 PhlexibleCountryContextBundle
- 更新您的数据库模式
- 清除 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