Trashie
Trashie

Reputation: 61

Symfony: Overriding/Adding routes from inherited bundle

Suppose i have a few sites that share around 80% of their functionality, including things like routing strategy, templates,etc. I'd like to use the same codebase for all them, and have a "DefaultSiteBundle", and several "SiteABundle","SiteBBundle" overriding or adding functionality to the DefaultSiteBundle using bundle inheritance.

This means, the DefaultSiteBundle should always be loaded, and, depending on the domain name, load SiteABundle or SiteBBundle conditionally.

My problem is, how do i manage routes, without adding all SiteBundles to app/config/routing.yml?

Upvotes: 1

Views: 206

Answers (1)

Trashie
Trashie

Reputation: 61

The way i've solved it, in the end, was using a custom router, based on the Advanced loader explained in the symfony docs.The router loads and merges routes from both bundles. It's also important to create separate caches for each site (overriding "getCacheDir" in AppKernel so it returns a different path for each domain)

Upvotes: 1

Related Questions