ConsoleBundle icon indicating copy to clipboard operation
ConsoleBundle copied to clipboard

Loader not called

Open dschenck opened this issue 10 years ago • 6 comments

Hi,

Pulled a fresh Symfony 2.7.4 and added consolebundle The routing is not added.

Bundle works if you add routing manually via import in app/config/routing.yml so the services are loaded.

I threw an error in the CoreSphere\ConsoleBundle\Routing\Loader -> load() method (threw 1/0), the error was not raised... so is this method called at all?. Any idea why routing not added?

dschenck avatar Sep 23 '15 13:09 dschenck

I guess that's an error in the readme file. @TomasVotruba wanted to change the bundle to load the routes automagically but I just read on http://symfony.com/doc/current/cookbook/routing/custom_route_loader.html that you still need to add

console:
    resource: .
    type: extra

to your routing_dev.yml

laszlokorte avatar Sep 23 '15 18:09 laszlokorte

Ok, confirmed.

Perhaps it would be better to revert to the old import method? I am note sure what the benefits of this loading method has over

_console:
    resource: "@CoreSphereConsoleBundle/Resources/config/routing.yml"

It surely adds a layer of (unwarranted?) complexity - or at least, it obscures the routes.

On a side note, @TomasVotruba I guess the CoreSphereConsoleExtension -> prepend() doesn't work then for routing?

dschenck avatar Sep 23 '15 22:09 dschenck

It seems like the prepending works just for "normal" config values but not for routes. If this is the case I agree we should revert the change because the old way to include the routes looks simpler.

laszlokorte avatar Sep 23 '15 22:09 laszlokorte

I'd rather add:

console:
    resource: .
    type: extra

to README.md, since it might be used by other packages or modular routing for controllers.

TomasVotruba avatar Sep 24 '15 08:09 TomasVotruba

(I have already fixed the readme for now)

the "extra" label seems pretty arbitrary to me - like an artifact from following the example code. shouldn't it be renamed to something more bundle specific like "console" or "coresphere" or "coresphere_console"? Other bundles may use the "extra" label as well and then I am not able to distinguish which routes I want to load.

laszlokorte avatar Sep 24 '15 12:09 laszlokorte

Thanks.

I don't have any knowledge about "extra" key meaning, so feel free to adjust as needed. If it's something package specific, "coresphere_console" would be fine.

TomasVotruba avatar Sep 24 '15 13:09 TomasVotruba