简体   繁体   English

索纳塔媒体捆绑和翻译

[英]Sonata Media Bundle and Translation

I have a web portal built with Symfony 2.8 and Sonata Admin. 我有一个使用Symfony 2.8和Sonata Admin构建的Web门户。

I am using Sonata Translation along with Gedmo's Translatable behavior to manage multilanguage entities in my website and it's working fine. 我正在使用Sonata Translation和Gedmo的Translatable行为来管理我网站中的多语言实体,并且运行良好。

I added Sonata Media to handle images and files but I can't translate them. 我添加了Sonata Media来处理图像和文件,但无法翻译它们。 When I try to add @Gedmo\\Translatable to a Media entity I get this error: 当我尝试将@Gedmo\\Translatable添加到Media实体时,出现此错误:

/**
 * @var \Application\Sonata\MediaBundle\Entity\Media|null
 *
 * @ORM\ManyToOne(targetEntity="\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist", "remove"})
 * @ORM\JoinColumn(name="video_1", referencedColumnName="id", onDelete="SET NULL")
 * @Gedmo\Translatable
 */
protected $video1;

Console error: 控制台错误:

[Gedmo\Exception\InvalidMappingException]                                    
Unable to find translatable [video1] as mapped property in entity - AppBundle\Entity\Module      

Is it possible to translate uploaded files or do I have to manually handle it without Sonata Media? 是否可以翻译上载的文件,或者必须在没有Sonata Media的情况下手动处理?

You trying to translate field, that do not exist it database. 您尝试翻译字段,该数据库不存在。 This property contains collection of Media entities. 此属性包含媒体实体的集合。 Try append 尝试附加

@Gedmo\\Translatable @Gedmo \\可翻译

to field in 参加

\\Application\\Sonata\\MediaBundle\\Entity\\Media \\ Application \\ Sonata \\ MediaBundle \\ Entity \\ Media

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM