-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement configuration via container extensions #17
Conversation
I think that the controller class should be renamed after this is merged. It's not really a base controller anymore. |
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:
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
# ...
Not that I want to change these settings all the time, but I need to have various configurations at the same time. Edit: this would again require separate controllers, I will think of something else. Not quite woken up yet ;-) |
ah that was next on my list. i didn't realize this bundle was that popular to get a comment so quickly. |
$contentName, | ||
$this->getTranslationFilePath(), | ||
$this->getTemplateExtension() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing: please do not remove those calls. They are extremely important for cases in which the class is extended. Why not just let the getTemplateExtension() method return the container-getParameter() call?
@vworldat that's exactly what i just did, since i think the work of making the configuration parser recursive deserves it's own pull request. I figured i'd implement that later. However.. I am against having a bloated controller. the way you suggested before is a more correct way of doing it. I definitely don't wanna have a bunch of configurable methods in a controller. I was planning on moving all that configurable stuff out to a template locator service. |
Well, actually a dedicated service to handle configuration / templates / etc would be great. I just don't have any idea yet, how this can be combined with the routing configuration. Using templates from several locations under several URLs might lead to something like this: #routing.yml
some_bundle_webpage_static:
pattern: /some/path/{name}
defaults: { _controller: "SomeWebpageBundle:StaticPage:show" }
requirements:
name: .*
my_bundle_webpage_static:
pattern: /{name}
defaults: { _controller: "MyWebpageBundle:StaticPage:show" }
requirements:
name: .*
This also is how it is currently used by me and @c33s (we were both involved in the basic development of the package). |
This adds configuration for all the extendable methods from the controller class. Currently this only supports the yaml file format. You can view all the configuration options by reading the Configuration class or running `app/console config:dump-reference c33s_static_pages`
sorry for all the churn.. this should be good to go now. |
Please give me 30 to 45 minutes, then I'll be able to join. Which channel? |
I think that's a bit soon for me. I'm going to bed soon, and we could probably end up talking for awhile. I'll just think a bit longer and then try to meet up soon. Hopefully the PR is good to go now? |
i guess the only thing that should be changed is maybe c33s_static_pages: to c33s_static_content. If it's ok other than that.. then please say so. so i can start using it in my own fork until you folks actually merge it. |
Since this is work in progress anyway, I think we can just leave it at that for now. |
…ions Implement configuration via container extensions
This means you can configure the bundle settings without extending
the base controller class.
For example: you can add these settings to your config.yml file
You can either look at the Configuration class or run
app/console config:dump-reference c33s_static_pages
(after pulling) to seea list of all current configuration parameters.