[英]SonataMediaBundle Type error when trying to delete the link with media
i have project that uses sonataAdmin and sonataMedia when i tried to delete the image using the check box provided by the bundle click to see image 我有尝试使用捆绑包提供的复选框删除图像时使用sonataAdmin和sonataMedia的项目, 请单击以查看图像
i get this error : 我收到此错误:
Type error: Argument 1 passed to BackBundle\\Entity\\reference::setMedia() must implement interface Sonata\\MediaBundle\\Model\\MediaInterface, null given, called in /home/hichem/PhpstormProjects/sifastProject/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php on line 591
类型错误:传递给BackBundle \\ Entity \\ reference :: setMedia()的参数1必须实现接口Sonata \\ MediaBundle \\ Model \\ MediaInterface,给定为null,在/ home / hichem / PhpstormProjects / sifastProject / vendor / symfony / symfony / src /中调用第591行的Symfony / Component / PropertyAccess / PropertyAccessor.php
it appears exactly here: 它恰好出现在这里:
Stack Trace
堆栈跟踪
in src/BackBundle/Entity/reference.php at line 69 -
/**
* @param MediaInterface $media
*/
public function setMedia(MediaInterface $media)
{
$this->media = $media;
}
from what i've understand(or at least think so)the setter can't set the value with null if any one know what's the problem please help 根据我的理解(或至少如此认为),如果有人知道问题所在,则设置器无法将值设置为null,请帮助
Because you have no selected file I think that this will help you: 因为您没有选择的文件,所以我认为这将为您提供帮助:
/**
* @param MediaInterface $media
*/
public function setMedia(MediaInterface $media = null)
{
$this->media = $media;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.