在我的实体中的一个方法中,我使用了一个参数“addlinkedDocuments”。
class Documents {
/**
* Many Documents link to many Documents.
* @ORM\ManyToMany(targetEntity="App\Entity\Documents", fetch="EAGER")
* @ORM\JoinTable(name="documents_documents",
* joinColumns={@JoinColumn(name="link_origin", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="link_destination", referencedColumnName="id")}
* )
* @Groups("documents")
*/
private $linkedDocuments;
public function __construct() {
$this->linkedDocuments = new ArrayCollection();
}
/**
* @return Collection|linkedDocuments[]
*/
public function getlinkedDocuments(): Collection
{
return $this->linkedDocuments;
}
public function addlinkedDocuments(linkedDocuments $linkedDocuments): self
{
if (!$this->linkedDocuments->contains($linkedDocuments)) {
$this->linkedDocuments[] = $linkedDocuments;
}
return $this;
}
public function removelinkedDocuments(linkedDocuments $linkedDocuments): self
{
if ($this->linkedDocuments->contains($linkedDocuments)) {
$this->linkedDocuments->removeElement($linkedDocuments);
}
return $this;
}
但我收到错误消息:
类“App\Entity\Documents”中方法“addlinkedDocuments”中参数“linkedDocuments”的类型提示无效。
慕码人8056858