Symfony 3.2.7和sonata媒体包安装

时间:2017-04-20 14:12:33

标签: symfony sonata sonata-media-bundle

我试图在symfony 3.2.7 / php7 / doctrine environnement上安装奏鸣曲媒体包。

我正在接受此文档:https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html

但是当我使用此命令行生成DB时,我遇到错误:php bin / console doctrine:schema:update --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 bin / console doctrine:schema:validate

我有以下消息:

[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": "~2.0@dev",
"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 个答案:

答案 0 :(得分:1)

您的config.yml标识错误

根据https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html

,这应该是正确的
SELECT usuarios.id, usuarios.nombre, usuarios.curso, usuarios.grupo, usuarios.alergias, padres.nombreFROM usuarios