1 回答

TA貢獻1803條經(jīng)驗 獲得超6個贊
據(jù)我所知,在Documents.
因此,任何給定的文檔都可以與許多其他文檔相關(guān)。
linkedDocuments只是保存 的集合的變量的名稱Documents。
我的觀點是鏈接的文檔不是類型linkedDocumentsbut Documents,所以你的類型提示應(yīng)該相應(yīng)地改變:
/**
* @return Collection|Document[]
*/
public function getlinkedDocuments(): Collection
{
return $this->linkedDocuments;
}
public function addlinkedDocument(Document $linkedDocument): self
{
if (!$this->linkedDocuments->contains($linkedDocument)) {
$this->linkedDocuments[] = $linkedDocument;
}
return $this;
}
public function removelinkedDocument(Document $linkedDocument): self
{
if ($this->linkedDocuments->contains($linkedDocument)) {
$this->linkedDocuments->removeElement($linkedDocument);
}
return $this;
}
編輯:根據(jù) Cerad 的建議,我已經(jīng)去重命名方法以更好地反映多元化。所以你的類應(yīng)該被調(diào)用,Document以便任何一個給定的文檔都可以鏈接到許多文檔。
- 1 回答
- 0 關(guān)注
- 139 瀏覽
添加回答
舉報