Setting up multiple Kernels in Symfony 4

519 views Asked by At

I am trying to set up a multi-site architecture in Symfony 4 using multiple Kernels.

It would be too lengthy to post all of the changes I have made but I basically followed the Symfony docs for creating a new Kernel and the changes I made can be viewed in the following pull request.

When I attempt to run the api kernel locally (php bin/api server:run) I get the following error message:

Error Message

I am simply trying to load the home controller and template using the new Kernel

# config/api/routes.yaml

home:
    path: /
    controller: App\Controller\Home::index
1

There are 1 answers

1
Vadim Ashikhman On
  1. Place routes.yaml under config/routes directory, otherwise Symfony treats this file as a framework configuration file.

  2. Or you can reconfigure kernel to load routes files from api directory by editig configureContainer and configureRoutes methods of ApiKernel.