2017-04-20 80 views
1

我試圖在symfony 3.2.7/php7/doctrine environnement上安裝奏鳴曲媒體包。Symfony 3.2.7和奏鳴曲媒體包安裝

我如下因素這個文檔:https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html

但我有,當我使用此命令行的錯誤,產生DB:PHP斌/控制檯學說:架構:更新--force

錯誤信息:

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

也,當我打字這個comande行:PHP斌/控制檯學說:架構:驗證

我有followi NG的消息:

[Mapping] FAIL - The entity-class 'Sonata\MediaBundle\Entity\BaseMedia' mapping is invalid: 
* The field 'Sonata\MediaBundle\Entity\BaseMedia#providerMetadata' uses a non-existant type 'json'. 

[Mapping] FAIL - The entity-class 'Application\Sonata\MediaBundle\Entity\Media' mapping is invalid: 
* The field 'Application\Sonata\MediaBundle\Entity\Media#providerMetadata' uses a non-existant type 'json'. 

這是我composer.json:

"require": { 
"php": ">=5.5.9", 
"symfony/symfony": "3.2.*", 
"doctrine/orm": "^2.5", 
"doctrine/doctrine-bundle": "^1.6", 
"doctrine/doctrine-cache-bundle": "^1.2", 
"symfony/swiftmailer-bundle": "^2.3.10", 
"symfony/monolog-bundle": "^3.0.2", 
"symfony/polyfill-apcu": "^1.0", 
"sensio/distribution-bundle": "^5.0", 
"sensio/framework-extra-bundle": "^3.0.2", 
"incenteev/composer-parameter-handler": "^2.0", 
"symfony/intl": "^3", 
"hautelook/alice-bundle": "^1.3", 
"doctrine/doctrine-fixtures-bundle": "^2.3", 
"friendsofsymfony/user-bundle": "[email protected]", 
"jms/translation-bundle": "dev-master", 
"jms/i18n-routing-bundle": "dev-master", 
"sonata-project/admin-bundle": "^3.16", 
"sonata-project/doctrine-orm-admin-bundle": "^3.1", 
"sonata-project/media-bundle": "^3.5" 
}, 

你知道我在做什麼錯?

這是我config.yml:

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 

回答

1

你config.yml有錯identation

這應該是正確的,根據https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html

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 
+0

可惜這並不是說,它只是該身份與我的複製和粘貼有關 – sisischakal

相關問題