symfony2 mediabundle字段类型

时间:2014-07-14 09:40:39

标签: php symfony doctrine-orm media image-uploading


我正在使用这个媒体包
http://symfony.com/doc/master/cmf/bundles/media/introduction.html

我遇到的问题是我不知道设置实体字段的字段类型

/**
 * @var Image
 *
 * @ORM\Column(name="image", type="???WHAT TYPE GOES HERE???", length=255)
 */
private $image;

我尝试过字符串(适用于创作,但无法编辑或显示)

给我这个错误

The form's view data is expected to be an instance of class 
Symfony\Cmf\Bundle\MediaBundle\Doctrine\Phpcr\Image, but is a(n) string. 
You can avoid this error by setting the "data_class" option to null 
or by adding a view transformer that transforms 
a(n) string to an instance of Symfony\Cmf\Bundle\MediaBundle\Doctrine\Phpcr\Image. 

还尝试将Image和Symfony \ Cmf \ Bundle \ MediaBundle \ Doctrine \ Phpcr \ Image
无法识别此类型。
最后尝试了data_class = null,这不被认为是该字段的选项之一

0 个答案:

没有答案