が他のそれはあなたがCMFバンドルと自動配線、route_basepathに新しく追加された、非常に複雑な作業ですが、これをやろうと、あなたが依存している場合など、イベントリスナーによって動的に変更することはできませんその要求はその時点では利用できません。
オーバーライド「cmf_routing.phpcr_candidates_prefix」サービス、および独自の候補者のプレフィックスサービスとそれに対するすべての参照を置き換えます
は、私は次の操作を行って、それを行うことができました。
class OverrideRoutePrefixListener implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$routePrefixDefinition = $container->getDefinition('cmf_routing.phpcrodm_route_idprefix_listener');
$routePrefixDefinition->replaceArgument(0, new Reference('app.phpcr_candidates_prefix'));
$routeLocalePrefixDefinition = $container->getDefinition('cmf_routing.phpcrodm_route_locale_listener');
$routeLocalePrefixDefinition->replaceArgument(0, new Reference('app.phpcr_candidates_prefix'));
}
}
元をサブクラス化し、コンストラクタを変更する必要がありますあなた自身のサービスは、あなたがなど、独自のcmf_routing.phpcr_candidates_prefixの内部
public function __construct(array $prefixes, array $locales = array(), ManagerRegistry $doctrine = null, $limit = 20)
{
// Do something else here, if you just want multiple prefixes, its supported by the config
// But if you want to fetch them from the database or the like, you have to do this.
$prefixes = ['/users/admin/sites/test/routes', '/users/admin/sites/test/simple'];
parent::__construct($prefixes, $locales = array(), $doctrine = null, $limit = 20);
$this->setPrefixes($prefixes);
$this->doctrine = $doctrine;
}
プライベートフィールドの束をコピーする必要があります、あなたは無料ですプレフィックスをあなたが望むものに解決する。
2番目の手順はPhpcrOdmAdapterをオーバーライドしています。これをコンパイラパスでも行うことができます。
class OverridePhpcrOdmAdapter implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('cmf_routing_auto.adapter.phpcr_odm');
$definition->setClass(PhpcrOdmAdapter::class);
}
}
コンストラクタのベースパスを変更します。
特定の環境に合わせて設定を作成する必要があります。 config_subdomainなど。次に、AppKernelで目的の環境をロードします。 – fyrye
その特定のサイトへのルートを含むユーザーと「サイト」ドキュメントは、外出先で作成されるため、これは悪い考えであり、編集する必要があります。 –
パラメータを使用することも、複数のパラメータを使用することもできますが、アプリケーションはconfig.ymlに含めるパラメータとして目的の 'routes'がどこにあるかを知る必要があります。 EG: 'route_basepath: '%kernel.user_routes%''私は自分自身で '%router.request_context.host%'を使っていますが、私のアプリケーションは設定によって隔離されています。 – fyrye