【问题标题】:vichuploadbundle and KnpLabs/DoctrineBehaviors (translatable) [Symfony]vichuploadbundle 和 KnpLabs/DoctrineBehaviors(可翻译)[Symfony]
【发布时间】:2018-08-03 09:52:41
【问题描述】:

我使用捆绑包 KnpLabs/DoctrineBehaviors(可翻译)来管理我的翻译。

我还使用 bundle vichuploadbundle 来管理我的 img。

我有一个实体,它必须有不同的图像,具体取决于语言,所以我将 img 字段和注释 Vich\UploadField 放在我的 entityTranslatable 实体中。 但我无法在 Twig 上显示图像......我有这个错误:

Error display

这是我的树枝代码:

{{  vich_uploader_asset(creation, 'imageCreation ') }}

还有这个,我的实体代码:

/**
 * @Vich\UploadableField(mapping="image_creation", fileNameProperty="image")
 * @var File
 */
private $imageCreation;

编辑:

我的第一个问题没关系。但是现在我有一个错误,因为找不到我的图像字段的映射...如何映射这个?因为我的图像字段不在我的 Creation 实体中,而是在我的 CreationTranslation 实体中?

Display error

提前谢谢你

【问题讨论】:

  • 消息似乎很清楚:将@Vich\Uploadable 放在您的创建实体之上。

标签: php symfony vichuploaderbundle


【解决方案1】:

关注文档https://github.com/dustin10/VichUploaderBundle/blob/master/Resources/doc/usage.md

 /**
 * @ORM\Entity
 * @Vich\Uploadable
 */
    class Creation
    {

    }

【讨论】:

  • 感谢您的快速响应,我的第一个问题没关系。但是现在我有一个错误,因为找不到我的图像字段的映射...如何映射这个?因为我的图像字段不在我的 Creation 实体中,而是在我的 CreationTranslation 实体中?
猜你喜欢
  • 1970-01-01
  • 2018-08-02
  • 2023-04-02
  • 2013-07-11
  • 1970-01-01
  • 1970-01-01
  • 2022-11-30
  • 1970-01-01
  • 2011-08-23
相关资源
最近更新 更多