更新时间:2023-11-17 17:15:16
请查看有关关联映射的官方文档此处。
Take a look at the official documentation about association mapping here.
尝试这样:
在BlogLinkTag中
In BlogLinkTag
/**
* @var integer
* @ORM\ManyToOne(targetEntity="Blog", inversedBy="tags") //put the name of the variable in the other entity here
* @ORM\JoinColumn(name="blog_id", referencedColumnName="id") //reference of the column targetted here
*/
private $blog;
在博客中:
/**
* @ORM\OneToMany(targetEntity="BlogLinkTag", mappedBy="blog") //put the name of the variable in the other entity here
*/
protected $tags;