Skip to content

Instantly share code, notes, and snippets.

@larseirik
Forked from mms-uret/gist:0781f2e88c3ed2fdc233
Last active September 10, 2015 11:07
Show Gist options
  • Save larseirik/15629696927848f59bc4 to your computer and use it in GitHub Desktop.
Save larseirik/15629696927848f59bc4 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