【发布时间】:2021-03-04 09:38:52
【问题描述】:
我有两个班级:
class Product {
/**
* @ORM\OneToMany(targetEntity=Keyword::class, mappedBy="product")
*/
private $keywords;
}
class Keyword {
/**
* @ORM\Column(type="string", length=255)
*/
private $description;
/**
* @ORM\ManyToOne(targetEntity=Product::class, inversedBy="keywords")
*/
private $product;
}
在我定义的产品的 CRUD 控制器中:
public function configureFields(string $pageName): iterable
{
yield CollectionField::new('keywords');
}
它正确显示了所有关键字,但是当我尝试保存它时出现错误:
“App\Entity\Keyword”、“字符串”类型的预期参数在属性路径“关键字”处给出。
是否有可能将这样的连接显示为集合?这样管理关键字会容易得多。
【问题讨论】:
标签: php symfony symfony5 easyadmin