Skip to content

support per controller configuration without requiring controller extension #22

Description

So i originally wrote #17 as way of configuring options globally. I planned on finding some way to allow per section overrides.
#17 works for us now, as it allows everything to work as it previously did.

So moving forward, we have a couple of options.

I'll start with a quote from @vworldat on the PR as a way to get things going

This change does not allow for several bundles to hold static content at the >same time. For me this is a dealbraker. I want to be able to:

have content in several bundles/controllers
use different "settings" (e.g. base template) depending on the controller being used

This is easily possible at the moment, but not with your changes. What about changing the config to something like this:

c33s_static_pages:
    My\Bundle\Controller\MyController:
        content_dir:    Pages
        wrapper_template: something
        # ...
    My\Bundle\Controller\OtherController:
        content_dir:    Stuff
        wrapper_template: something
        # ...
    My\OtherBundle\Controller\MyController:
        content_dir:    Sites
        wrapper_template: something
        # ...

So that could work, but i do wonder if we really care about controllers? or do we actually care about pages ( and sub pages and directories). Also, are there options here that are actually bundle wide and shouldn't be overridden?

There are some other ways to possibly solve this.

We can support specifying templates and some other options with an event listener in a similiar fashion to FrameworkExtraBundle. It works with annotations, but the logic can still be used without it by setting the request parameters ourselves.

It would end looking something like this in your route config file.

my_route:
    path: /pages/*
    defaults:
        _controller: MyControllerClass
        _template: my_template.html.twig

Another alternative is the Dynamic Router used by symfony-cmf. This could be the best option, since it has route enhancers that lets you add whatever you want to the route parameters without making a mess.

The CMF Router
http://symfony.com/doc/master/cmf/reference/configuration/routing.html

The CMF Routing Bundle (for symfony integration):
http://symfony.com/doc/master/cmf/bundles/routing/dynamic.html

With the dynamic router we would implement it based on file tree(s) instead of using
a database.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions