symfony - 如何映射到从实体中的内存提供的用户
问题描述
我正在设置一个实体,我需要存储与实体一起操作的用户。问题是用户不是从数据库中提供的,而是从 security.yml 的内存中提供的。
安全.yml
encoders:
Symfony\Component\Security\Core\User\User:
algorithm: bcrypt
cost: 15
UserBundle\Entity\Customer:
algorithm: bcrypt
cost: 15
providers:
chain_provider:
chain:
providers: [admins_load_from_memory, customers_load_from_db]
admins_load_from_memory:
memory:
users:
achref:
password:...
roles: 'ROLE_ADMIN'
customers_load_from_db:
entity: { class: UserBundle\Entity\Customer, property: email }
/**
* @ORM\ManyToOne(targetEntity="Symfony\Component\Security\Core\User\User")
*/
private $treatedBy;
当我尝试更新数据库时,出现此错误:
In MappingException.php line 22:
The class 'Symfony\Component\Security\Core\User\User' was not found in the chain configured namespaces AppBundle\Entity, UserBundle\Entit
y
解决方案
推荐阅读
- python-3.x - 如何加快我在 python 中的集成程序?
- node.js - 尝试在路由内使用带有 socket.io 的发射事件
- java - 如何使倒计时进度条不断下降?
- r - Unique title for sapply when using rasters
- css - 图像不会仅水平扩展并开始新行?如何改变这个?
- python - python statsmodels 线性回归
- python - 努力规范嵌套的 JSON 数据
- cytoscape.js - 如何使用 cytoscape.js 的不稳定分支
- python - 如何用python制作动画
- sql - 具有不同分组的 SQL 聚合函数