我正在尝试在Symfony 3.2.7/php7/Doctrine Environment上安装Sonata Media Bundle。
我正在寻找此文档:https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html
但是,当我使用此命令行时,我有一个错误,以生成DB:PHP bin/console学说:架构:update -force
错误消息:
[DoctrineDBALDBALException]
Unknown column type "json" requested. Any Doctrine type that you use has to be registered with DoctrineDBALTypesType::addT
ype(). You can get a list of all the known types with DoctrineDBALTypesType::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学说:架构:validate
我有以下消息:
[Mapping] FAIL - The entity-class 'SonataMediaBundleEntityBaseMedia' mapping is invalid:
* The field 'SonataMediaBundleEntityBaseMedia#providerMetadata' uses a non-existant type 'json'.
[Mapping] FAIL - The entity-class 'ApplicationSonataMediaBundleEntityMedia' mapping is invalid:
* The field 'ApplicationSonataMediaBundleEntityMedia#providerMetadata' uses a non-existant type '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: SonataDoctrineTypesJsonType
sonata_media:
# if you don't use default namespace configuration
#class:
# media: MyVendorMediaBundleEntityMedia
# gallery: MyVendorMediaBundleEntityGallery
# gallery_has_media: MyVendorMediaBundleEntityGalleryHasMedia
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
您的config.yml的标识错误
这应该是正确的,根据https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html
doctrine:
orm:
entity_managers:
default:
mappings:
ApplicationSonataMediaBundle: ~
SonataMediaBundle: ~
dbal:
types:
json: SonataDoctrineTypesJsonType
sonata_media:
# if you don't use default namespace configuration
#class:
# media: MyVendorMediaBundleEntityMedia
# gallery: MyVendorMediaBundleEntityGallery
# gallery_has_media: MyVendorMediaBundleEntityGalleryHasMedia
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