博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FOSCommentBundle功能包:设置Doctrine ODM映射(投票)
阅读量:5748 次
发布时间:2019-06-18

本文共 1160 字,大约阅读时间需要 3 分钟。

  • 原文出处:

  • 原文作者:

  • 授权许可:

  • 翻译人员:FireHare

  • 校对人员:

  • 适用版本:FOSCommentBundle 2.0.5

  • 文章状态:草译阶段

Step 12b: Setup MongoDB mapping

The MongoDB implementation does not provide a concrete Vote class for your use,you must create one:

ROM实现并没有提供一个具体的Vote类给您使用,您需要创建一个:

And you should implement VotableCommentInterface in your Comment class and add a field to your mapping:

并且您需要在您的Comment类中实现 VotableCommentInterface 接口,并添加一个字段到您的映射中:

score = $score; } /** * Returns the current score of the comment. * * @return integer */ public function getScore() { return $this->score; } /** * Increments the comment score by the provided * value. * * @param integer value * * @return integer The new comment score */ public function incrementScore($by = 1) { $this->score += $by; }

Configure your application(配置您的应用程序)

In YAML:

YAML格式:

# app/config/config.ymlfos_comment:    db_driver: mongodb    class:        model:            vote: MyProject\MyBundle\Document\Vote

Or if you prefer XML:

如果您偏好XML:

# app/config/config.xml

Back to the main step(返回主步骤)

.

第12步:启用投票。

转载地址:http://qgqzx.baihongyu.com/

你可能感兴趣的文章
读书笔记-高标管事 低调管人
查看>>
Master带给世界的思考:是“失控”还是进化
查看>>
用户和开发者不满苹果iCloud问题多多
查看>>
java.lang.UnsatisfiedLinkError:no dll in java.library.path终极解决之道
查看>>
我的工具:文本转音频文件
查看>>
【许晓笛】从零开始运行EOS系统
查看>>
【跃迁之路】【460天】程序员高效学习方法论探索系列(实验阶段217-2018.05.11)...
查看>>
C++入门读物推荐
查看>>
TiDB 源码阅读系列文章(七)基于规则的优化
查看>>
面试中会遇到的正则题
查看>>
Spring之旅第八站:Spring MVC Spittr舞台的搭建、基本的控制器、请求的输入、表单验证、测试(重点)...
查看>>
数据结构与算法——常用排序算法及其Java实现
查看>>
你所不知的Webpack-多种配置方法
查看>>
React.js 集成 Kotlin Spring Boot 开发 Web 应用实例详解
查看>>
webpack+typescript+threejs+vscode开发
查看>>
python读excel写入mysql小工具
查看>>
如何学习区块链
查看>>
搜索问题的办法
查看>>
微信分销系统商城营销5大重点
查看>>
求职准备 - 收藏集 - 掘金
查看>>