首页 文章

Symfony - trim()期望参数1为字符串

提问于
浏览
0

我与Symfony 2 / Doctrine Sonata Admin有问题(问题) . 我试图呼叫控制台,但它仍然给我这个错误

[Symfony\Component\Config\Exception\FileLoaderLoadException]
  Warning: trim() expects parameter 1 to be string, array given in C:/xampp-server/htdocs/sarkamartinu/app/config\con
  fig.yml (which is being imported from "C:/xampp-server/htdocs/sarkamartinu/app/config/config_dev.yml").

我不知道问题出在哪里 . 这是配置

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: services.yml }
    - { resource: sonata_translation.yml }
    - { resource: ../../vendor/knplabs/doctrine-behaviors/config/orm-services.yml }
    - { resource: @AppBundle/Resources/config/services.yml}
    - { resource: @AppBundle/Resources/config/admin.yml }

# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: cs

framework:
    #esi:             ~
    translator:      { fallbacks: [en] }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    #serializer:      { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  cs
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        # handler_id set to null will use default session handler from php.ini
        handler_id:  ~
    fragments:       ~
    http_method_override: true

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    cache:  false
    form:
            resources:
                - 'SonataCoreBundle:Form:datepicker.html.twig'


ivory_ck_editor:
    default_config: default
    configs:
        default:
            filebrowserBrowseRoute: elfinder
            filebrowserBrowseRouteParameters: []

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        types:
            json: Sonata\Doctrine\Types\JsonType
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #     path:     "%database_path%"

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        entity_managers:
            default:
                naming_strategy: doctrine.orm.naming_strategy.underscore
                auto_mapping: true
                mappings:
                    ApplicationSonataMediaBundle: ~
                    SonataMediaBundle: ~
                    ApplicationSonataUserBundle: ~
                    SonataUserBundle: ~
                    FOSUserBundle: ~

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"

#FOSUser
fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: Application\Sonata\UserBundle\Entity\User

    group:
        group_class:   Application\Sonata\UserBundle\Entity\Group
        group_manager: sonata.user.orm.group_manager

    service:
        user_manager: sonata.user.orm.user_manager

#Sonata
sonata_admin:
    templates:
        short_object_description: ::sonata-image-preview.html.twig

sonata_block:
    default_contexts: [cms]
    blocks:
        # Enable the SonataAdminBundle block
        sonata.admin.block.admin_list:
            contexts:   [admin]
        # Your other blocks
        sonata.user.block.menu:    # used to display the menu in profile pages
        sonata.user.block.account: # used to display menu option (login option)
        sonata.block.service.text: # used to if you plan to use Sonata user routes

sonata_user:
    security_acl: false
    manager_type: orm # can be orm or mongodb

sonata_media:
    # if you don't use default namespace configuration
    #class:
    #    media: MyVendor\MediaBundle\Entity\Media
    #    gallery: MyVendor\MediaBundle\Entity\Gallery
    #    gallery_has_media: MyVendor\MediaBundle\Entity\GalleryHasMedia
    default_context: default
    db_driver: doctrine_orm # or doctrine_mongodb, doctrine_phpcr
    contexts:
        default:  # the default context is mandatory
            providers:
                - sonata.media.provider.image
                - sonata.media.provider.file
            formats:
                small: { width: 300, height: 200, quality: 100}
                hq: { width: 1920, height: 1080, quality: 100}
        admin:
            providers:
                - sonata.media.provider.image
                - sonata.media.provider.file
            formats:
                small: { width: 150, height: 100, quality: 100}
        Category:
            providers:
                - sonata.media.provider.image
            formats:
                small: { width: 300, height: 200, quality: 100}
                 hq: { width: 1920, height: 1080, quality: 100}
        Feedback:
            providers:
                - sonata.media.provider.image
            formats:
                small: { width: 67, height: 67, quality: 100}
    providers:
        image:
            thumbnail:  sonata.media.thumbnail.liip_imagine
    cdn:
        server:
            path: ''

    filesystem:
        local:
            directory:  %kernel.root_dir%/../www/uploads/media
            create:     true

liip_imagine:
    resolvers:
        default:
            web_path:
                web_root: %kernel.root_dir%/../www
                cache_prefix: /uploads/cache
    loaders:
        default:
            filesystem:
                data_root: %kernel.root_dir%/../www/uploads/media
        sonata_media_loader:
            filesystem:
                data_root: %kernel.root_dir%/../www
    filter_sets:
        cache: ~
        default_small:
            data_loader: sonata_media_loader
            quality: 100
            filters:
                thumbnail: { size: [300, 200], mode: outbound }
        Category_small:
            data_loader: sonata_media_loader
            quality: 100
            filters:
                thumbnail: { size: [300, 200], mode: outbound }
        Feedback_small:
            data_loader: sonata_media_loader
            quality: 100
            filters:
                thumbnail: { size: [67, 67], mode: outbound }
        admin:
            data_loader: sonata_media_loader
            quality: 100
            filters:
                thumbnail: { size: [150, 100], mode: outbound }

a2lix_translation_form:
    locale_provider: default
    locales: [cs, en]
    default_locale: cs
    required_locales: [cs, en]
    manager_registry: doctrine
    templating: "A2lixTranslationFormBundle::default.html.twig"

fm_elfinder:
    instances:
        default:
            locale: %locale% # defaults to current request locale
            editor: ckeditor # other options are tinymce, tinymce4, form, custom and simple
            fullscreen: true # defaults true, applies to simple and ckeditor editors
            include_assets: true # disable if you want to handle loading of the javascript and css assets yourself
            connector:
                debug: false # defaults to false
                roots:       # at least one root must be defined
                    uploads:
                        show_hidden: false # defaults to false
                        driver: LocalFileSystem
                        path: uploads/editor
                        upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
                        upload_deny: ['all']
                        upload_max_size: 2M

这是config_dev.yml

imports:
        - { resource: config.yml }

    framework:
        router:
            resource: "%kernel.root_dir%/config/routing_dev.yml"
            strict_requirements: true
        profiler: { only_exceptions: false }

    web_profiler:
        toolbar: true
        intercept_redirects: false

    monolog:
        handlers:
            main:
                type:   stream
                path:   "%kernel.logs_dir%/%kernel.environment%.log"
                level:  debug
            console:
                type:   console
                bubble: false
                verbosity_levels:
                    VERBOSITY_VERBOSE: INFO
                    VERBOSITY_VERY_VERBOSE: DEBUG
                channels: ["!doctrine"]
            console_very_verbose:
                type:   console
                bubble: false
                verbosity_levels:
                    VERBOSITY_VERBOSE: NOTICE
                    VERBOSITY_VERY_VERBOSE: NOTICE
                    VERBOSITY_DEBUG: DEBUG
                channels: ["doctrine"]
            # uncomment to get logging in your browser
            # you may have to allow bigger header sizes in your Web server configuration
            #firephp:
            #    type:   firephp
            #    level:  info
            #chromephp:
            #    type:   chromephp
            #    level:  info

    assetic:
        use_controller: true

    #swiftmailer:
    #    delivery_address: me@example.com

1 回答

  • 0

    我有同样的问题,补充一下

    _main:
        resource: routing.yml
        type: be_simple_i18n
    

    在你的 routing_dev.yml

相关问题