php - Default value for subdomain in Routing.yml Symfony2 -


The following is my routing.yml which includes all the routes from the controller:

Parameters.yml

  domain: testmultidb.hrd   

routing.iml

  vi_company: resource: "@ViCompanyBundle / Controller /" Type: Annotation Prefix: / Host: "Administrator. {Company}.% Domain%" Default: # Company: # There is no way to get the name of the subdomain here   

Now, Anything like {company} can be company1, company2, companyn ... , so the issue URL answers Happens all the time in various me it Company parameters

  & lt; A href = "{{path (" vi_company_dashboard ", {company: subdomainName}}}}> dashboard and lieutenant must pass; / a & gt;   

This is to eliminate this {company: subdomain name} . Therefore it will get "company1" from admin.company1.testmultidb.hrd, from "company2" to admin.company2.testmultidb.hrd < / P>

There is also to ban any subdomain:

  vi_company: Resource: "ViCompanyBundle / Controller /" Type: Annotation prefix: / host: "Administrator. {Company}.% Domain%" Requirements: # Company: Any way to restrict 'super' subdomains   

Thank you for reading my question.

The router has a RequestContext object, which literally refers to the current request.
When generating the root route, it completes the lack of parameters with them. < P> So if you set up the RequestContext before setting the default company , it can work fine:

  $ this-> Obtain ('router.request_context') - & gt; SetParameter ('Company' $ request & gt; attributes- & gt; Mill ('Company')); This code should be worked on all request by EventDispatcher after the  router aliour :: onKernelRequest (i.e. the priority must be less than 16).   

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -