Skip to content

Instantly share code, notes, and snippets.

@mms-uret
Created September 10, 2015 08:21
Show Gist options
  • Save mms-uret/0781f2e88c3ed2fdc233 to your computer and use it in GitHub Desktop.
Save mms-uret/0781f2e88c3ed2fdc233 to your computer and use it in GitHub Desktop.
Multiple application in EzPublishKernel
class EzPublishKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// all the bundles
);
$app = $this->getApp();
if ($app == 'backend') {
$bundles[] = 'SRF\\BackendBundle';
}
// environment dependendet bundles
return $bundles;
}
public function getCacheDir()
{
return $this->rootDir.'/cache/'.$this->environment.'/'.$this->getApp();
}
/**
* {@inheritdoc}
*/
public function getLogDir()
{
return $this->rootDir.'/logs/'.$this->getApp();
}
/**
* Parsing the domain and uri and returns the app
*
* @return string
*/
private function getApp()
{
$app = 'frontend';
if ($SERVER['HTTP_HOST'] == 'backend.srf.ch') {
$app = 'backend';
}
return $app;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getApp();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment