2017-08-08 4 views
0

essaie d'installer ensemble des médias sur une sonate symfony 3.3.6Sonata Média Bundle Erreur d'installation

Je folowing cette doc: https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html

Mais j'ai une erreur quand je suis en utilisant cette commande ligne, pour générer DB: php doctrine bin/console: schéma: mise à jour --force

le message d'erreur:

[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.

mon config.yml est tirée de la documentati sur. J'ai passé en revue tous ces articles et nulle part je ne peux trouver une réponse. Pourquoi cette erreur se produit-elle? Aide s'il vous plaît, je commence à être déçu

Répondre

0

Vous devez ajouter le type JSON dans la configuration de votre doctrine:

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

Dans votre fichier de configuration, vous avez la section de doctrine deux fois. Le premier est appliqué:

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 

et vous n'a pas défini le JSON de type là.

+0

J'ai ces constructions – dmitry76

+0

Vous avez la section de doctrine deux fois. C'est inacceptable. vous devez fusionner cette configuration. le premier est appliqué et vous n'avez pas de type JSON ici. – Vladislav

+0

OMG! J'avais des soupçons, mais je suis nouveau dans la symphonie, merci beaucoup! – 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: ~