Sonata MediaBundle配置问题

时间:2017-10-03 11:35:36

标签: php symfony symfony-forms sonata-admin sonata-media-bundle

  

我正在使用Symfony3.3

错误

[Symfony的\元器件\ DependencyInjection \异常\ ServiceNotFoundException的]
  该服务" sonata.media.admin.media"依赖于不存在的服务" sonata.admin.builder.orm_form"。

当我运行此命令时

php app/console sonata:easy-extends:generate --dest=src SonataMediaBundle

在配置文档Media Bundle

中提到

我的config.yml是

imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: Bundle/FOS/fos_user.yml }
- { resource: "@UserBundle/Resources/config/services.yml" }
- { resource: Bundle/SONATA/sonata_block.yml }
- { resource: Bundle/SONATA/sonata_media_bundle_config.yml }
parameters:
      locale: en

framework:
    #esi: ~
    translator: { fallbacks: ['%locale%'] }
    secret: '%secret%'
    router:
        resource: '%kernel.project_dir%/app/config/routing.yml'
        strict_requirements: ~
    form: ~
    csrf_protection:
            enabled: true
    validation: { enable_annotations: true }
    #serializer: { enable_annotations: true }
    templating:
        engines: ['twig']
    default_locale: '%locale%'
    trusted_hosts: ~
    session:

        handler_id: session.handler.native_file
        save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
    fragments: ~
    http_method_override: true
    assets: ~
    php_errors:
        log: true
doctrine:
    dbal:
        driver: "pdo_pgsql"
        host: '%database_host%'
        port: '%database_port%'
        dbname: '%database_name%'
        user: '%database_user%'
        password: '%database_password%'
        charset: UTF8
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path:     '%kernel.project_dir%/var/data/data.sqlite'
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #path: '%database_path%'
        types:
            json: Sonata\Doctrine\Types\JsonType

orm:
    auto_generate_proxy_classes: %kernel.debug%
    default_entity_manager: default
    entity_managers:
        default:
            auto_mapping: true
            mappings:
                SonataMediaBundle: ~

我的Bundle / SONATA / sonnata_media_bundle_config.yml和Bundle / SONATA / sonata_block.yml是

sonata_media:
    db_driver: doctrine_orm # or doctrine_mongodb, doctrine_phpcr it is mandatory to choose one here
    default_context: default # you need to set a context
    # if you don't use default namespace configuration
    class:
        media: MediaBundle\Entity\Media
        gallery: MediaBundle\Entity\Gallery
        gallery_has_media: MediaBundle\Entity\GalleryHasMedia
    contexts:
        default:  # the default context is mandatory
            providers:
                - sonata.media.provider.image
                - sonata.media.provider.file

formats: small: { width: 100, quality: 100} medium: { width: 500 , quality: 100} big: { width: 970 , quality: 100} providers: image: resizer: sonata.media.resizer.square cdn: server: path: /uploads/media # http://media.sonata-project.org/ filesystem: local: directory: "%kernel.root_dir%/../web/uploads/media" create: false providers: image: filesystem: sonata.media.filesystem.local resizer: sonata.media.resizer.square cdn: sonata.media.cdn.server generator: sonata.media.generator.default thumbnail: sonata.media.thumbnail.format allowed_extensions: ['jpg', 'png', 'jpeg', 'gif', 'tiff'] allowed_mime_types: ['image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/gif', 'image/tiff'] file: service: sonata.media.provider.file resizer: false filesystem: sonata.media.filesystem.local cdn: sonata.media.cdn.server generator: sonata.media.generator.default thumbnail: sonata.media.thumbnail.format allowed_extensions: ['pdf', 'txt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pttx', 'odt', 'odg', 'odp', 'ods', 'odc', 'odf', 'odb', 'csv', 'xml'] allowed_mime_types: ['application/pdf', 'application/x-pdf', 'application/rtf', 'text/html', 'text/rtf', 'text/plain'] image: thumbnail: sonata.media.thumbnail.format pixlr: enabled: true referrer: Demo - Sonata Project resizer: simple: mode: inset buzz: connector: sonata.media.buzz.connector.file_get_contents ***My Bundle/SONATA/sonata_block.yml is*** sonata_block: default_contexts: [cms] blocks: # enable the SonataAdminBundle block sonata.admin.block.admin_list: contexts: [admin]

0 个答案:

没有答案