0

例如,当我转到注册 url 时,这是我收到的错误消息:

**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

4

0 回答 0