php - The Doctrine repository "Doctrine\ORM\EntityRepository" must implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface -


i'm receiving error the doctrine repository "doctrine\orm\entityrepository" must implement symfony\bridge\doctrine\security\user\userloaderinterface.

this done following symfony own login , databases , doctrine examples, thought customization.

customer.php: `

// src/appbundle/entity/customer.php  namespace appbundle\entity;   use doctrine\orm\mapping orm;  use symfony\component\security\core\user\userinterface;  use symfony\component\security\core\user\advanceduserinterface;    /**    * @orm\entity(repositoryclass="appbundle\entity\customerrepository")    */   class customer implements advanceduserinterface, \serializable  {   /**  * @var integer  */ private $id;  /**  * @var string  */ private $customer_firstname;  /**  * @var string  */ private $customer_lastname;  /**  * @var string  */ private $customer_email;  /**  * @var string  */ private $customer_password;  /**  * @var string  */ private $customer_salt;  /**  * @var string  */ private $customer_notes;  /**  * @var integer  */ private $customer_server_id;  /**  * @var string  */ private $customer_panel_account;  /**  * @var integer  */ private $customer_invoicing_account;  /**  * @var integer  */ private $customer_is_active;   /**  * set id  *  * @param integer $id  *  * @return customer  */ public function setid($id) {     $this->id = $id;      return $this; }  /**  * id  *  * @return integer  */ public function getid() {     return $this->id; }  /**  * set customerfirstname  *  * @param string $customerfirstname  *  * @return customer  */ public function setcustomerfirstname($customerfirstname) {     $this->customer_firstname = $customerfirstname;      return $this; }  /**  * customerfirstname  *  * @return string  */ public function getcustomerfirstname() {     return $this->customer_firstname; }  /**  * set customerlastname  *  * @param string $customerlastname  *  * @return customer  */ public function setcustomerlastname($customerlastname) {     $this->customer_lastname = $customerlastname;      return $this; }  /**  * customerlastname  *  * @return string  */ public function getcustomerlastname() {     return $this->customer_lastname; }  /**  * set customeremail  *  * @param string $customeremail  *  * @return customer  */ public function setcustomeremail($customeremail) {     $this->customer_email = $customeremail;      return $this; }  /**  * customeremail  *  * @return string  */ public function getcustomeremail() {     return $this->customer_email; }  /**  * set customerpassword  *  * @param string $customerpassword  *  * @return customer  */ public function setcustomerpassword($customerpassword) {     $this->customer_password = $customerpassword;      return $this; }  /**  * customerpassword  *  * @return string  */ public function getcustomerpassword() {     return $this->customer_password; }  /**  * set customersalt  *  * @param string $customersalt  *  * @return customer  */ public function setcustomersalt($customersalt) {     $this->customer_salt = $customersalt;      return $this; }  /**  * customersalt  *  * @return string  */ public function getcustomersalt() {     return $this->customer_salt; }  /**  * set customernotes  *  * @param string $customernotes  *  * @return customer  */ public function setcustomernotes($customernotes) {     $this->customer_notes = $customernotes;      return $this; }  /**  * customernotes  *  * @return string  */ public function getcustomernotes() {     return $this->customer_notes; }  /**  * set customerserverid  *  * @param integer $customerserverid  *  * @return customer  */ public function setcustomerserverid($customerserverid) {     $this->customer_server_id = $customerserverid;      return $this; }  /**  * customerserverid  *  * @return integer  */ public function getcustomerserverid() {     return $this->customer_server_id; }  /**  * set customerpanelaccount  *  * @param string $customerpanelaccount  *  * @return customer  */ public function setcustomerpanelaccount($customerpanelaccount) {     $this->customer_panel_account = $customerpanelaccount;      return $this; }  /**  * customerpanelaccount  *  * @return string  */ public function getcustomerpanelaccount() {     return $this->customer_panel_account; }  /**  * set customerinvoicingaccount  *  * @param integer $customerinvoicingaccount  *  * @return customer  */ public function setcustomerinvoicingaccount($customerinvoicingaccount) {     $this->customer_invoicing_account = $customerinvoicingaccount;      return $this; }  /**  * customerinvoicingaccount  *  * @return integer  */ public function getcustomerinvoicingaccount() {     return $this->customer_invoicing_account; }  public function isaccountnonexpired() {   return true; }  public function isaccountnonlocked() {   return true; }  public function iscredentialsnonexpired() {   return true; }  /**  * check if customer accoutn activate  *  */   public function isenabled()  {    return $this->customer_is_active;  }  /**  * set customerisactive  *  * @param integer $customerisactive  *  * @return customer  */ public function setcustomerisactive($customerisactive) {     $this->customer_is_active = $customerisactive;      return $this; }  /**  * customerisactive  *  * @return integer  */ public function getcustomerisactive() {     return $this->customer_is_active; }  /** added these functions because of security controller */  /**  * username  *  * @return string  */  public function getusername()  {    return $this->customer_email;  }   public function getpassword()  {    return $this->customer_password;  }   public function getsalt()  {    return $this->customer_salt;  }   public function getroles()  {    return array('role_user');  }   public function erasecredentials()  {   }   public function serialize()  {     return serialize(array(       $this->id,       $this->customer_email,       $this->customer_password,       $this->customer_is_active     ));  }   public function unserialize($serialized)  {    list (     $this->id,     $this->customer_email,     $this->customer_password,     $this->customer_is_active    ) = unserialize($serialized);  } } 

customerrepository.php:

<?php   //src/appbundle/entity/customerrepository.php  use symfony\bridge\doctrine\security\user\userloadinterface; use symfony\component\security\core\user\userinterface; use symfony\component\security\core\exception\usernamenotfoundexception; use doctrine\orm\entityrepository;  class customerrepository extends entityrepository implements   userloaderinterface {  public function loaduserbyusername($email)   {   $user = $this->createquerybuilder('c')     ->where('c.customer_email = :email')     ->setparameter('email', $email)     ->getquery()     ->getoneornullresult();      if(null === $user)     {       $message = sprintf(         'unable find active user appbundle:user object identified "%s".',         $email       );       throw new usernamenotfoundexception($message);      }      return $user; } } 

i have found 1 similar question in here (stack overflow) last year, thought version 2.5* , did not me. i'm using symfony3. link question: the doctrine repository "doctrine\orm\entityrepository" must implement userproviderinterface in symfony2

you cannot mix annotations , yaml/xml mappings means default repository class being retrieved instead of custom class. add repository class line mapping file under resources/config/doctrine.

# customer.orm.yml appbundle\entity\game:   type:  entity   table: customers   repositoryclass: appbundle\entity\customerrepository 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -