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