移除Symfony中父类的映射主义字段 [FOSUserBundle][英] Remove mapped doctrine field of parentclass in Symfony [FOSUserBundle]

本文是小编为大家收集整理的关于移除Symfony中父类的映射主义字段 [FOSUserBundle]的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

如何从映射中删除作为学说列继承的字段?

示例:

在fosuserbundle中,我不需要在我的用户类中的一些列(例如盐,expiresat ...).如何告诉Symfony/Toctrine不再将此列映射到数据库/将其从映射中删除?我知道如何使用@attributeoverride"重新配置"列,但是如何从映射中完全删除字段?

问候.

推荐答案

几乎必须所有fosub用户实体的默认属性使捆绑包按预期工作.

您给出的字段(盐,expiresat)与安全性有关,是用户属性的大部分.

删除其中一个可能在您的用户管理中具有副作用.

另外,您不能选择性地继承了实体的部分.

本文地址:https://www.itbaoku.cn/post/2090827.html

问题描述

How is it possible to remove a field that got inherited as doctrine column from mapping?

Example:

In FosUserBundle, I don't need some of the columns (e.g. salt, expiresAt...) within my User class. How can I tell symfony/doctrine to not map this column anymore to the database / remove it from the mapping? I know how to "reconfigure" the columns by using @AttributeOverride, but how can I completly remove a field from the mapping?

Regards.

推荐答案

Pretty much all default properties of the FOSUB User entity are mandatory to make the bundle working as expected.

The fields you given (salt, expiresAt) are related to the security, as the most part of the User properties.

Remove one of them may have side effects in your user management.

Also, you can't Selectively inherit parts of an entity.