このチュートリアルhttp://symfony.com/doc/current/cookbook/security/entity_provider.htmlと同様のログイン機能を実装しましたが、ログインしようとすると、次のようになります。
"There is no user provider for user "App\SomeBundle\Entity\User""
私のリポジトリは、必要なインターフェイス、リポジトリへのユーザーエンティティ参照を実装し、security.yml で、カスタムエンティティプロバイダーの例のようにプロバイダーを定義しました。エラーが発生する理由がわかりません。
security.yml には次のものがあります。
security:
encoders:
\App\SomeBundle\Entity\User: sha512
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
...
providers:
main:
entity: { class: AppSomeBundle:User }
...
ユーザー エンティティのヘッダー:
/**
* App\SomeBundle\Entity\User
*
* @ORM\Table(
* name="user",
* uniqueConstraints={
* @ORM\UniqueConstraint(name="email_unique", columns={"user_email"})
* }
* )
* @ORM\Entity(repositoryClass="App\SomeBundle\EntityRepository\UserRepository")
*/
class User implements UserInterface, EquatableInterface, \Serializable
{
およびリポジトリのヘッダー:
class UserRepository extends EntityRepository implements UserProviderInterface
{
手伝ってくれてありがとう。