Hi,

I have a theory that there is a simple way to do this, however I have
never tried it so please bare with me.

In Symfony2 there is a variable used called $_SERVER['KERNEL_DIR'];
the reason I know its there is because I set it in my bundle unit test
boot strap to make sure the kernel sets up correctly in test cases
which require the kernel.

My theory is that you could set up different app.php files in your web
folder and set the $_SERVER['KERNEL_DIR'] in the app.php file

For instance if you have a sight called cats.com and another site
called dogs.com and they both used the same symfony base code but
different apps you could create one app folder and call it cats and
another app folder called dogs

Then in your .htaccess you could do something where you point all
traffic to cats.com at app_cats.php and all dogs.com traffic at
app_dogs.php

Then in your app_cats.php it would be like this:

<?php

$_SERVER['KERNEL_DIR']  =  __DIR__.'/../cats;

require_once $_SERVER['KERNEL_DIR'] .'/bootstrap.php.cache';
require_once $_SERVER['KERNEL_DIR'] .'/AppKernel.php';

use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$kernel->handle(Request::createFromGlobals())->send();

You'd probably have to make a similar change in your console script
but I think this would work. Please let me know if it does.

On Jun 23, 2:52 am, Robert Knutsson <[email protected]> wrote:
> Hi
>
> I needed two applications in my symfony2 project and read the manual
> (http://symfony.com/doc/2.0/cookbook/symfony1.html) where
> the concept of applications in symfony2 was explained.
>
> Although the manual is very vague on how to implement two
> applications, and there is no "best-practice" to be found on the
> subject.
>
> My issue is that I wanna keep duplicated code to a minimum, and I need
> some input on how to not duplicate "bootstrap.php.cache",
> "autoload.php" and "console".
>
> Could you recommend me some best practices when it comes to multiple
> applications in symfony2 or share your experiences?
>
> Cheers,
> Robert

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to