Symfony 尝试将项添加到关联(ArrayCollection):调用未定义的方法XXXProxy::add

Symfony 尝试将项添加到关联(ArrayCollection):调用未定义的方法XXXProxy::add,symfony,doctrine-orm,Symfony,Doctrine Orm,当我尝试将项目添加到助手中时 /** * In Note class * @var \Doctrine\Common\Collections\ArrayCollection * * @ORM\ManyToMany(targetEntity="User") */ protected $responders; // in controller: line 80, where error occurs $note->getResponders()->add($user);

当我尝试将项目添加到助手中时

/**
 * In Note class
 * @var \Doctrine\Common\Collections\ArrayCollection
 * 
 * @ORM\ManyToMany(targetEntity="User")
 */
protected $responders;

// in controller: line 80, where error occurs
$note->getResponders()->add($user);
我明白了

在第80行的…\Controller\NotesController.php中调用未定义的方法代理…UserBundleEntityUserProxy::add()

怎么了

更新


我注意到它在
UserProxy
下查找add方法,它不应该在
NoteProxy
中吗?由于应答者在
笔记中
课堂?

好的,我的问题得到了回答。这是一个复制粘贴错误

public function getResponders() {
    return $this->*author*;
}