[英]How to add the input username in fosCommentBundle without fosUser?
我想在不使用 FOSUserBundlde 的情况下在捆绑包 FOSCommentBundle 中添加用户名字段(输入)。
用户必须输入他的用户名和评论。 基本 model 不提供伪字段,因为它依赖于连接的用户或“匿名”(如果没有连接的用户)。
你能告诉我怎么做吗?
Symfony 4.4
谢谢
捆绑包中的评论只是配置中贴标的实体。 我想你这样做了?
https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/Resources/doc/2a-mapping_orm.md
所以我认为您只需将新属性$userName
添加到您的评论实体。 我发现这个https://github.com/FriendsOfSymfony/FOSCommentBundle/issues/334
我从未使用过该捆绑包,但问题评论中回答的是纯粹的 symfony 行为。 您必须覆盖 Bundle 的表单和模板。
该表格: https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/Form/CommentType.php
从任何包中覆盖 FormType
https://symfony.com/doc/4.4/form/create_form_type_extension.html
并覆盖模板
https://symfony.com/doc/current/bundles/override.html#templates
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.