当我提交我的表格时,我得到了这个例外:
Found the public method "addRemote", but did not find a public "removeRemote" on class App\CoreBundle\Entity\Scene
奇怪的想法是存在 remove 方法......但我自己写的(当我做 php app/console 学说:generate:entities)学说并没有生成它。我做错什么了吗?
/**
* @var array $remote
*
* @ORM\Column(name="remote", type="array", nullable=true)
*/
private $remote;
/**
* Set remote
*
* @param array $remote
* @return Scene
*/
public function addRemote($value, $key=null) {
if($key!=null){
$this->remote[$key] = $value;
}else{
$this->remote[] = $value;
}
return $this;
}
/**
* Remove remote
*/
public function removeRemote(){
unset($this->remote);
}
我也试过:
/**
* Remove remote
*/
public function removeRemote($key=null){
if($key!=null && array_key_exists($key, $this->remote)){
unset($this->remote[$key]);
}
unset($this->remote);
return $this;
}