2017-08-08 3 views
0

は、私はこのdoc folowingてる3.3.6ソナタメディアバンドルのインストールエラー

symfonyの上ソナタメディアバンドルをインストールしようとしている:https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html

をしかし、私は、私は、このコマンドを使用していますエラーが発生していますライン、DBを生成するために:私のconfig.ymlがdocumentatiから取られ

[Doctrine\DBAL\DBALException] Unknown column type "json" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineType Mapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.

:エラーメッセージ

--force更新:PHPのbin /コンソール教義:スキーマをに。私はそのような記事をすべて見直して答えを見つけることができません。このエラーはなぜ発生しますか?あなたが二回教義のセクションを持って、あなたの設定ファイルで

doctrine: 
    dbal: 
     types: 
      json:  Sonata\Doctrine\Types\JsonType 

を:ヘルプ、私は

答えて

0

失望するために始めてくださいあなたは、あなたの教義の設定でJSONタイプを追加する必要があります。

doctrine: 
    dbal: 
     driver: pdo_mysql 
     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%' 

    orm: 
     auto_generate_proxy_classes: '%kernel.debug%' 
     naming_strategy: doctrine.orm.naming_strategy.underscore 
     auto_mapping: true 

、あなたがそこにJSON形式を定義していませんでした: 最初のものが適用されます。

+0

私はこの構造を持っています – dmitry76

+0

あなたはdoctrineセクションを2回持っています。それは容認できない。この構成をマージする必要があります。最初のものが適用され、そこにJSONタイプがありません。 – Vladislav

+0

OMG!私は疑念を抱いていましたが、私はシンフォニーには新しいです、ありがとう! – dmitry76

0
imports: 
    - { resource: parameters.yml } 
    - { resource: security.yml } 
    - { resource: services.yml } 
    - { resource: "@AppBundle/Resources/config/admin.yml" } 
    - { resource: sonata_classification.yml } 
# Put parameters here that don't need to change on each machine where the app is deployed 
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration 
parameters: 
    locale: ru 

framework: 
    #esi: ~ 
    translator: { fallbacks: ['%locale%'] } 
    secret: '%secret%' 
    router: 
     resource: '%kernel.project_dir%/app/config/routing.yml' 
     strict_requirements: ~ 
    form: ~ 
    csrf_protection: ~ 
    validation: { enable_annotations: true } 
    #serializer: { enable_annotations: true } 
    templating: 
     engines: ['twig'] 
    default_locale: '%locale%' 
    trusted_hosts: ~ 
    session: 
     # https://symfony.com/doc/current/reference/configuration/framework.html#handler-id 
     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 

# Twig Configuration 
twig: 
    debug: '%kernel.debug%' 
    strict_variables: '%kernel.debug%' 

# Doctrine Configuration 
doctrine: 
    dbal: 
     driver: pdo_mysql 
     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%' 

    orm: 
     auto_generate_proxy_classes: '%kernel.debug%' 
     naming_strategy: doctrine.orm.naming_strategy.underscore 
     auto_mapping: true 

# Swiftmailer Configuration 
swiftmailer: 
    transport: '%mailer_transport%' 
    host: '%mailer_host%' 
    username: '%mailer_user%' 
    password: '%mailer_password%' 
    spool: { type: memory } 

#Cache 
doctrine_cache: 
    providers: 
     my_markdown_cache: 
      type: file_system 
      file_system: 
       directory: /tmp/doctrine_cache 

sonata_admin: 
    title: My Blog Admin 


sonata_block: 
    default_contexts: [cms] 
    blocks: 
     sonata.admin.block.admin_list: 
      contexts: [admin] 

doctrine: 
    orm: 
     entity_managers: 
      default: 
       mappings: 
        ApplicationSonataMediaBundle: ~ 
        SonataMediaBundle: ~ 


    dbal: 
     types: 
      json: Sonata\Doctrine\Types\JsonType 

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 
    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 
    contexts: 
     default: # the default context is mandatory 
      providers: 
       - sonata.media.provider.dailymotion 
       - sonata.media.provider.youtube 
       - sonata.media.provider.image 
       - sonata.media.provider.file 
       - sonata.media.provider.vimeo 

      formats: 
       small: { width: 100 , quality: 70} 
       big: { width: 500 , quality: 70} 

    cdn: 
     server: 
      path: /uploads/media # http://media.sonata-project.org/ 

    filesystem: 
     local: 
      directory: "%kernel.root_dir%/../web/uploads/media" 
      create:  false 

sonata_media: 
    providers: 
     image: 
      resizer: sonata.media.resizer.square 

doctrine: 
    orm: 
     entity_managers: 
      default: 
       mappings: 
        ApplicationSonataMediaBundle: ~ 
        SonataMediaBundle: ~