我收到错误127.0.0.1:12345
这主要是通过symfony自己的登录和数据库以及学说示例完成的,并考虑了一些自定义。
Customer.php: `
The Doctrine repository "Doctrine\ORM\EntityRepository" must implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface.
CustomerRepository.php:
// src/AppBundle/Entity/Customer.php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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;
}
/**
* Get 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 is 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;
}
/**
* Get customerIsActive
*
* @return integer
*/
public function getCustomerIsActive()
{
return $this->customer_is_active;
}
/** Added these functions because of the security controller */
/**
* Get 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);
}
}
我在去年发现了一个类似的问题(堆栈溢出),认为是版本2.5 *并没有帮助我。我正在使用symfony3。链接到问题:The Doctrine repository "Doctrine\ORM\EntityRepository" must implement UserProviderInterface in symfony2
答案 0 :(得分:1)
您不能混合注释和yaml / xml映射,这意味着正在检索默认存储库类而不是您的自定义类。将存储库类行添加到Resources / config / doctrine下的映射文件中。
# customer.orm.yml
AppBundle\Entity\Game:
type: entity
table: customers
repositoryClass: AppBundle\Entity\CustomerRepository