这是我收到的错误消息,例如,我转到注册网址:
**Call to undefined method MyEntity::setEnabled() FOS\UserBundle\Controller\RegistrationController.php on line 44**
(FOS在我的内核中注册)
我自己的用户实体扩展了 FOS \ UserBundle \ Model \ User ,我还试图扩展 FOS \ UserBundle \ Entity \ User
这样:
<?php
namespace NRtworks\SubscriptionBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use FOS\UserBundle\Model\User as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="icousers")
*/
class icousers extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=50, unique = true)
*/
protected $type;
/**
* @ORM\Column(type="integer", length=5)
*/
protected $customer;
public function __construct()
{
parent::__construct();
// your own logic
}
public function getid()
{
return $this->id;
}
public function gettype()
{
return $this->type;
}
public function getcustomer()
{
return $this->customer;
}
public function setid($x)
{
return $this->id=$x;
}
public function settype($x)
{
return $this->type=$x;
}
public function setcustomer($x)
{
return $this->customer=$x;
}
}
?>
我没有更改代码,因此方法setEnabled被写入 FOS \ UserBundle \ Model \ User
我不知道这里有什么不对......
我使用Symfony 2.1.7