3

如何使用 StofDoctrineExtensionsBundle 同时使实体字段“可上传”和​​“可翻译”?

这是我在实体中尝试做的事情:

产品.php

/**
* Product
*
* @ORM\Table("product")
* @ORM\Entity(repositoryClass="My\Bundle\Entity\ProductRepository")
*
* @Vich\Uploadable
*/
class Product
{
....
/**
 * @Assert\File(
 *     maxSize="30M"
 * )
 * @Vich\UploadableField(mapping="product_file", fileNameProperty="fileName")
 *
 * @var File $file
 */
public $file;

/**
 *
 * @Gedmo\Translatable
 * @ORM\Column(type="string", length=255, name="file_name", nullable=true)
 *
 * @var string $fileName
 */
protected $fileName;

不幸的是,它不起作用。

4

0 回答 0