Add default_admin_services node#7077
Conversation
|
One question: Why dont you decorate the service you want to modify? It is a feature available at the symfony dependency injection component and it allows to not write more code to do the same |
I don't always want to modify a service. |
|
Please review @sonata-project/contributors |
|
I will update the tests after #7127 |
|
Please review @sonata-project/contributors |
|
If the use case was to select one of the available label translation strategies, what about to just add an option to set the default one? |
What's the issue with the option Other use case can be:
|
|
IMO for modifying existing services you can do it with a service decorator as @jordisala1991 said, I think we don't need to provide a way to override them (it is the way it's documented in Symfony for overriding services from a bundle). For templates we already have a |
I may not understanding correctly decoration, but I don't think it solves the issue. In #4637, the goal is to use a different label_translator_strategy. For pager_type, you can use Another example: I wrote a whole custom datasource service and I'd like to use it for almost all my admin.
We can add |
|
What I meant is:
For example in doctrine:
dbal:
default_connection: default
orm:
default_entity_manager: ~We could add: sonata_admin:
default_label_strategy: 'sonata.admin.label.strategy.native' # by defaultThis way, instead of: could be
and If for example we create a service that receives the label translation strategy, this way we could inject
In this case (I know it was that way, but this is a new feature)
When decorating the service there is no need to configure it with the existing one, you can use it or not.
IMHO if we already have a configuration for templates (and if it's possible), we should use it, AFAIK the |
When I read the documentation The old definition is lost.
You might want to use your custom service 90% of the time and still keep the old definition sometimes.
I just followed the existing feature, and the way it's done for attributes of the tag IMHO we should keep consistency between the What I have in mind is to allow the user to change the default values of the |
|
@franmomu @jordisala1991 Can you take a new look ?
|
|
Can I get some review @sonata-project/contributors |
| ->arrayNode('form_theme') | ||
| ->prototype('scalar')->end() | ||
| ->end() | ||
| ->arrayNode('filter_theme') | ||
| ->prototype('scalar')->end() | ||
| ->end() |
There was a problem hiding this comment.
Should these new values be documented somewhere?
|
I updated the doc :) |
|
Perhaps it would be worthwhile to somehow more explicitly state that this change breaks BC, and give an upgrade example. -sonata_doctrine_orm_admin:
- templates:
- form:
- - '@Frontend/Admin/form/doctrine_orm_admin_fields.html.twig'
- - '@Frontend/Admin/form/admin_fields.html.twig'
- filter:
- - '@Frontend/Admin/form/filter_fields.html.twig'
+sonata_admin:
+ templates:
+ form_theme:
+ - '@Frontend/Admin/form/doctrine_orm_admin_fields.html.twig'
+ - '@Frontend/Admin/form/admin_fields.html.twig'
+ filter_theme:
+ - '@Frontend/Admin/form/filter_fields.html.twig' |
This PR is not supposed to break BC. |
Subject
BC
Changelog