-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Update multiple_kernels.rst #12724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update multiple_kernels.rst #12724
Conversation
Thanks for your contribution. Can you explain why we should add this? Thanks |
Because without the added code, we will have the following error : Error: Class App\ApiKernel contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (App\ApiKernel::configureRoutes) N.B : |
@amine-betari thanks for this contribution ... but I'm having some problems trying to understand the change. In this example, the code extends from |
it's normal because your links pointenst to master which is branch 5.0 I think On the other hand if you check the version by putting 4.3 or 4.4 you will have well the error |
@amine-betari sorry! You are right. However, in this article we don't use the MicroKernelTrait but the normal Kernel class, right? |
For me, you just have to add also add the configureRoutes method Why ? Because if you do not use the MicroKernelTrait and extend the Kernel class you will have another problem which is the following one: Error: Class App\ApiKernel contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Symfony\Component\HttpKernel\KernelInterface::registerContainerConfiguration) Because the MicroKernelTrait defines the method: registerContainerConfiguration Exemple
} |
Close/reopen because Travis was stuck |
@ostark @javiereguiluz any news ? |
@ostark @javiereguiluz any news please ? |
FYI @amine-betari you used the wrong handle, I'm not Oskar 8000 . |
It’s me 😊 I am currently on a phone 📱 but will have a look later |
@amine-betari, thank you for working on this. I agree we should update the example to use the But I propose the following changes: public function registerBundles(): iterable
{
$contents = require $this->getProjectDir().'/config/api_bundles.php';
// ...
}
// ...
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->addResource(new FileResource($this->getProjectDir().'/config/api_bundles.php'));
$container->setParameter('container.dumper.inline_factories', true);
$confDir = $this->getProjectDir().'/config/api';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes): void
{
$confDir = $this->getProjectDir().'/config/api';
// load specific api routes
} We could even add the routes configuration since we fully implement |
Hi @amine-betari! Do you have any time/motivation to finish this PR based on the comments by @HeahDude? (please also explicitly add |
@wouterj |
Sorry man :) |
@wouterj done :) |
Thank you Amine! Fyi, I've tweaked the diff slightly during the merge. |
Error: Class App\ApiKernel contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (App\ApiKernel::configureRoutes)
N.B :
An abstract method can not contain a body, its presence simply indicates that each non-abstract daughter class will have to redefine this method by respecting its signature.