在我的User.php中,我有以下路由:
/**
* @ORM\Table(name="app_users")
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
*/
但是我在我的日志文件中得到一个错误:
Authentication request failed. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationServiceException(code: 0): The \"App\\Entity\\User\" entity has a repositoryClass set to \"App\\Repository\\UserRepository\", but this is not a valid class. Check your class naming. If this is meant to be a service id, make sure this service exists and is tagged with \"doctrine.repository_service\". at /Users/work/project/vendor/symfony/security/Core/Authentication/Provider/DaoAuthenticationProvider.php:85, RuntimeException(code: 0): The \"App\\Entity\\User\" entity has a repositoryClass set to \"App\\Repository\\UserRepository\", but this is not a valid class. Check your class naming. If this is meant to be a service id, make sure this service exists and is tagged with \"doctrine.repository_service\". at /Users/work/project/vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:71)"} []
发布于 2018-07-01 00:49:21
如果App\Repository\UserRepository.php不存在。要么在那里创建一个有效的存储库类,要么在不需要注释的情况下从实体中删除该注释。
如果文件确实存在,则可能是文件名或类定义有打字错误,例如,在某处大写错误。
发布于 2020-12-18 09:05:12
我将我的代码从:
/**
* @ORM\Entity(repositoryClass=ParcCarburantRepository::class)
*/
至:
/**
* @ORM\Entity(repositoryClass="App\Repository\ParcCarburantRepository")
*/
它工作完美,对不起,我不知道为什么..。但它是有效的。
发布于 2021-11-24 10:35:15
更改:
/**
* @ORM\Table(name="CommandeLigne")
* @ORM\Entity(repositoryClass="App\Repository\CommandeLigneRepository")
*/
至:
/**
* @ORM\Entity
* @ORM\Table(name="CommandeLigne")
* (repositoryClass="App\Repository\CommandeLigneRepository")
*/
https://stackoverflow.com/questions/51116753
复制相似问题