I have a web portal built with Symfony 2.8 and Sonata Admin.
I am using Sonata Translation along with Gedmo's Translatable behavior to manage multilanguage entities in my website and it's working fine.
I added Sonata Media to handle images and files but I can't translate them. When I try to add @Gedmo\\Translatable
to a Media entity I get this error:
/**
* @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?
You trying to translate field, that do not exist it database. This property contains collection of Media entities. Try append
@Gedmo\\Translatable
to field in
\\Application\\Sonata\\MediaBundle\\Entity\\Media
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.