Sonata 媒体包 - pdf 上传显示 ROLE 错误

Sonata media bundle - pdf upload shows ROLE Error

我有一个带有 mediabundle 的图片上传器,但文件上传似乎不起作用。

我尝试上传 pdf 文件,但出现以下错误:

The media can be retrieved by users with the following roles : ROLE_SUPER_ADMIN, ROLE_ADMIN. 

我 100% 确定我拥有合适的管理员角色。在对代码进行深入搜索后,我发现 /sonata-project/doctrine-phpcr-admin-bundle/Model/ModelManager.php 创建函数会抛出一个错误:

String(83) "Field "width" of class "Application\Sonata\MediaBundle\PHPCR\Media" is not nullable"

我觉得我的 config.yml 应该没问题:

 providers:
    file:
        service:    sonata.media.provider.file
        resizer:    false
        filesystem: sonata.media.filesystem.local
        thumbnail:  sonata.media.thumbnail.format
        allowed_extensions: ['pdf', 'txt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pttx', 'odt', 'odg', 'odp', 'ods', 'odc', 'odf', 'odb', 'csv', 'xml']
        allowed_mime_types: ['application/pdf', 'application/x-pdf', 'application/rtf', 'text/html', 'text/rtf', 'text/plain']


    image:
        filesystem: sonata.media.filesystem.s3
        allowed_extensions: ['jpg', 'png', 'jpeg', 'gif']
        allowed_mime_types: ['image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/gif']
        resizer: sonata.media.resizer.custom

当我尝试在本地添加时,如您所见,上面的配置仍然无效。 sonata.media.filesystem.s3 上的 Neuther 丢失的默认 pdf 模板图像是否会导致问题?或者以前有人遇到过类似的问题?

缩放器预期的宽度和高度。即使 resizer 不是 pdf 所必需的,它也应该在 Application\Sonata\MediaBundle\PHPCR\Media class:

<?php
namespace Application\Sonata\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseMedia as BaseMedia;
/**
 * Media class
 *
 * @see https://sonata-project.org/bundles/easy-extends
 * @see http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
 */
class Media extends BaseMedia
{
    /**
     * @var integer
     */
    protected $id;
    /**
     * @var integer
     */
    protected $width = 0;
    /**
     * @var integer
     */
    protected $height = 0;
    /**
     * Get ID
     *
     * @return integer $id
     */
    public function getId()
    {
        return $this->id;
    }
}