我目前正在使用Symfony 4中的2.3版本的轻松管理包。
我试图为新视图创建一个虚拟属性。
我有以下配置
#config/packages/easy_admin.yaml
easy_admin:
entities:
Field:
class: App\Entity\Field
form:
fields:
- { type: tab, label: initial information, icon: pencil-alt }
- name
new:
fields:
- { property: toto, type: file }
以及我的实体文件:
//src/Entity/Field.php
/**
* @ORM\Entity(repositoryClass="App\Repository\FieldRepository")
*/
class Field
{
public function setToto(?File $file): self
{
$this->setImage(new Image);
$this->getImage()->setImageFile($file);
}
正如
documentation
这个
setter
应该足够了。
new
第一页出现以下错误:
属性“toto”和方法“getToto()”、“toto()”、“isToto()”、“hasToto()”、“\uu get()”都不存在,并且在类“App\Entity\Field”中都没有公共访问权限。
这意味着页面正在查找
getter
而不是
二传手
. 这是正常的还是我做错了什么?