sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

can not activate sonata.admin.label.strategy.underscore #3190

Closed OskarStark closed 5 years ago

OskarStark commented 9 years ago

when i use:

sonata_admin:
    security:
        handler: sonata.admin.security.handler.role
    admin_services:
        label_translator_strategy: sonata.admin.label.strategy.underscore

i got the following error: bildschirmfoto 2015-08-21 um 14 55 12

rande commented 9 years ago

can you display the stack trace ( -vvv) ?

OskarStark commented 9 years ago

bildschirmfoto 2015-08-21 um 15 05 11

as text:

Exception trace:
 () at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php:267
 Symfony\Component\Config\Definition\ArrayNode->validateType() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php:261
 Symfony\Component\Config\Definition\BaseNode->normalize() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php:269
 Symfony\Component\Config\Definition\PrototypedArrayNode->normalizeValue() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php:264
 Symfony\Component\Config\Definition\BaseNode->normalize() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php:301
 Symfony\Component\Config\Definition\ArrayNode->normalizeValue() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php:264
 Symfony\Component\Config\Definition\BaseNode->normalize() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php:33
 Symfony\Component\Config\Definition\Processor->process() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php:50
 Symfony\Component\Config\Definition\Processor->processConfiguration() at /Volumes/development/workspaces/tvthek/orf/vendor/sonata-project/admin-bundle/DependencyInjection/SonataAdminExtension.php:86
 Sonata\AdminBundle\DependencyInjection\SonataAdminExtension->load() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php:55
 Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:39
 Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:117
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:614
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /Volumes/development/workspaces/tvthek/orf/app/bootstrap.php.cache:2633
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /Volumes/development/workspaces/tvthek/orf/app/bootstrap.php.cache:2411
 Symfony\Component\HttpKernel\Kernel->boot() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Volumes/development/workspaces/tvthek/orf/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /Volumes/development/workspaces/tvthek/orf/app/console:27
OskarStark commented 9 years ago

looks like there should be a prototype node.... but when i execute app/console config:dump-reference sonata_admin

i get the following result:

# Default configuration for extension with alias: "sonata_admin"
sonata_admin:
    security:
        handler:              sonata.admin.security.handler.noop
        information:

            # Prototype
            id:                   []
        admin_permissions:

            # Defaults:
            - CREATE
            - LIST
            - DELETE
            - UNDELETE
            - EXPORT
            - OPERATOR
            - MASTER
        object_permissions:

            # Defaults:
            - VIEW
            - EDIT
            - DELETE
            - UNDELETE
            - OPERATOR
            - MASTER
            - OWNER
        acl_user_manager:     null
    title:                'Sonata Admin'
    title_logo:           bundles/sonataadmin/logo_title.png
    options:
        html5_validate:       true

        # Auto order groups and admins by label or id
        sort_admins:          false
        confirm_exit:         true
        use_select2:          true
        use_icheck:           true
        use_bootlint:         false
        pager_links:          null
        form_type:            standard
        dropdown_number_groups_per_colums:  2
        title_mode:           ~ # One of "single_text"; "single_image"; "both"

        # Enable locking when editing an object, if the corresponding object manager supports it.
        lock_protection:      false
    dashboard:
        groups:

            # Prototype
            id:
                label:                ~
                label_catalogue:      ~
                icon:                 '<i class="fa fa-folder"></i>'
                provider:             ~
                items:
                    admin:                ~
                    label:                ~
                    route:                ~
                    route_params:         []
                item_adds:            []
                roles:                []
        blocks:
            type:                 ~
            roles:                []
            settings:

                # Prototype
                id:                   ~
            position:             right
            class:                col-md-4
    admin_services:
        model_manager:        null
        form_contractor:      null
        show_builder:         null
        list_builder:         null
        datagrid_builder:     null
        translator:           null
        configuration_pool:   null
        route_generator:      null
        validator:            null
        security_handler:     null
        label:                null
        menu_factory:         null
        route_builder:        null
        label_translator_strategy:  null
        pager_type:           null
        templates:
            form:                 []
            filter:               []
            view:

                # Prototype
                id:                   ~
    templates:
        user_block:           'SonataAdminBundle:Core:user_block.html.twig'
        add_block:            'SonataAdminBundle:Core:add_block.html.twig'
        layout:               'SonataAdminBundle::standard_layout.html.twig'
        ajax:                 'SonataAdminBundle::ajax_layout.html.twig'
        dashboard:            'SonataAdminBundle:Core:dashboard.html.twig'
        search:               'SonataAdminBundle:Core:search.html.twig'
        list:                 'SonataAdminBundle:CRUD:list.html.twig'
        filter:               'SonataAdminBundle:Form:filter_admin_fields.html.twig'
        show:                 'SonataAdminBundle:CRUD:show.html.twig'
        show_compare:         'SonataAdminBundle:CRUD:show_compare.html.twig'
        edit:                 'SonataAdminBundle:CRUD:edit.html.twig'
        preview:              'SonataAdminBundle:CRUD:preview.html.twig'
        history:              'SonataAdminBundle:CRUD:history.html.twig'
        acl:                  'SonataAdminBundle:CRUD:acl.html.twig'
        history_revision_timestamp:  'SonataAdminBundle:CRUD:history_revision_timestamp.html.twig'
        action:               'SonataAdminBundle:CRUD:action.html.twig'
        select:               'SonataAdminBundle:CRUD:list__select.html.twig'
        list_block:           'SonataAdminBundle:Block:block_admin_list.html.twig'
        search_result_block:  'SonataAdminBundle:Block:block_search_result.html.twig'
        short_object_description:  'SonataAdminBundle:Helper:short-object-description.html.twig'
        delete:               'SonataAdminBundle:CRUD:delete.html.twig'
        batch:                'SonataAdminBundle:CRUD:list__batch.html.twig'
        batch_confirmation:   'SonataAdminBundle:CRUD:batch_confirmation.html.twig'
        inner_list_row:       'SonataAdminBundle:CRUD:list_inner_row.html.twig'
        outer_list_rows_mosaic:  'SonataAdminBundle:CRUD:list_outer_rows_mosaic.html.twig'
        outer_list_rows_list:  'SonataAdminBundle:CRUD:list_outer_rows_list.html.twig'
        outer_list_rows_tree:  'SonataAdminBundle:CRUD:list_outer_rows_tree.html.twig'
        base_list_field:      'SonataAdminBundle:CRUD:base_list_field.html.twig'
        pager_links:          'SonataAdminBundle:Pager:links.html.twig'
        pager_results:        'SonataAdminBundle:Pager:results.html.twig'
        tab_menu_template:    'SonataAdminBundle:Core:tab_menu_template.html.twig'
        knp_menu_template:    'SonataAdminBundle:Menu:sonata_menu.html.twig'
    assets:
        stylesheets:

            # Defaults:
            - bundles/sonatacore/vendor/bootstrap/dist/css/bootstrap.min.css
            - bundles/sonatacore/vendor/components-font-awesome/css/font-awesome.min.css
            - bundles/sonatacore/vendor/ionicons/css/ionicons.min.css
            - bundles/sonataadmin/vendor/admin-lte/dist/css/AdminLTE.min.css
            - bundles/sonataadmin/vendor/admin-lte/dist/css/skins/skin-black.min.css
            - bundles/sonataadmin/vendor/iCheck/skins/flat/blue.css
            - bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css
            - bundles/sonataadmin/vendor/jqueryui/themes/base/jquery-ui.css
            - bundles/sonatacore/vendor/select2/select2.css
            - bundles/sonatacore/vendor/select2-bootstrap-css/select2-bootstrap.min.css
            - bundles/sonataadmin/vendor/x-editable/dist/bootstrap3-editable/css/bootstrap-editable.css
            - bundles/sonataadmin/css/styles.css
            - bundles/sonataadmin/css/layout.css
            - bundles/sonataadmin/css/tree.css
        javascripts:

            # Defaults:
            - bundles/sonatacore/vendor/jquery/dist/jquery.min.js
            - bundles/sonataadmin/vendor/jquery.scrollTo/jquery.scrollTo.min.js
            - bundles/sonatacore/vendor/moment/min/moment.min.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/jquery-ui.min.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/i18n/jquery-ui-i18n.min.js
            - bundles/sonatacore/vendor/bootstrap/dist/js/bootstrap.min.js
            - bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js
            - bundles/sonataadmin/vendor/jquery-form/jquery.form.js
            - bundles/sonataadmin/jquery/jquery.confirmExit.js
            - bundles/sonataadmin/vendor/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.min.js
            - bundles/sonatacore/vendor/select2/select2.min.js
            - bundles/sonataadmin/vendor/admin-lte/dist/js/app.min.js
            - bundles/sonataadmin/vendor/iCheck/icheck.min.js
            - bundles/sonataadmin/vendor/slimScroll/jquery.slimscroll.min.js
            - bundles/sonataadmin/Admin.js
            - bundles/sonataadmin/treeview.js
    extensions:

        # Prototype
        id:
            admins:               []
            excludes:             []
            implements:           []
            extends:              []
            instanceof:           []
            uses:                 []
    persist_filters:      false
rande commented 9 years ago

From the test, https://github.com/sonata-project/SonataAdminBundle/blob/master/Tests/DependencyInjection/ConfigurationTest.php#L63-L94 the value need to be set per admin code.

OskarStark commented 9 years ago

yeah, i thought that, but then the dumped configuration is wrong

i would use the config component and use native as ->defaultValue()

what do you think?

rande commented 9 years ago

I don't understand your proposal.

OskarStark commented 9 years ago

sorry i was confused too :)

1) so when i dump the configuration there is no info, about the admin id, this level is completely missing. this should be fixxed i think

2) why we use defaultValue(Null) there and then add it later after by processing the config? if we use setDefaultValue() there the *.native-stratgedy would be dumped and shown

rande commented 9 years ago

@OskarStark

tophsic commented 9 years ago

Not sure to talk about the same thing :wink:

As the master documentation say:

sonata_admin:
    admin_services:
        # [...]
        label_translator_strategy:  null

I thougt we can define label_translator_strategy for all services but I found on this cookbook that I can only define it per service.

sonata_admin:
    admin_services:
        my_service:
            # [...]
            label_translator_strategy:  null

Is there a way to define it globally?

greg0ire commented 8 years ago

see #3319