博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mongodb 字段检索_检索Phabricator对象的自定义字段值
阅读量:2511 次
发布时间:2019-05-11

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

mongodb 字段检索

Phabricator is an incredibly well-coded PHP application but lacks a bit on the documentation side.  Then again, what open source project isn't?  Over the past months I've been slowly integrating Phabricator, a newish review tool, with Bugzilla, a much older tool.  The most recent step saw me needing to add a custom field (DifferentialCommitMessageCustomField class extension) to revisions:

Phabricator是一个编码非常出色PHP应用程序,但在文档方面缺乏一点。 再说一次,什么不是开源项目? 在过去的几个月中,我一直在缓慢地将Phabricator(一种新的查看工具)与一个较旧的工具Bugzilla集成在一起。 最近的步骤是我需要向修订添加一个自定义字段( DifferentialCommitMessageCustomField类扩展):

Phabricator Bug ID

Creating the DifferentialCommitMessageCustomField extension was fairly simple but, due to the structure of DifferentialRevision and other Phabricator classes, retrieving that field value isn't as easy as one would hope.  After trying a variety of methods and combing through the classes chain source code, it was Aviv Eyal that provided a nice utility function for retrieving custom field data for a given Phabricator object type:

创建DifferentialCommitMessageCustomField扩展非常简单,但是由于DifferentialRevision和其他Phabricator类的结构,检索字段值并不像人们希望的那样容易。 在尝试了各种方法并梳理了类链的源代码之后,Aviv Eyal提供了一个很好的实用程序函数来检索给定Phabricator对象类型的自定义字段数据:

function get_custom_field_value($object, $key_field) {  $field = PhabricatorCustomField::getObjectField(    $object,    PhabricatorCustomField::ROLE_DEFAULT,    $key_field  );  id(new PhabricatorCustomFieldStorageQuery())  ->addField($field)  ->execute();  $value = $field->getValueForStorage();  return $value;}

In my case, the $object was a DifferentialRevision and the $key_field is differential:bugzilla-bug-id, defined within my DifferentialCommitMessageCustomField extension.  If you are adding a CustomField of any kind to any Phabrication application, you can use this same method.

在我的情况下, $objectDifferentialRevision$key_fielddifferential:bugzilla-bug-id ,在我的DifferentialCommitMessageCustomField扩展中定义。 如果要将任何CustomField添加到任何Phabrication应用程序,则可以使用相同的方法。

When documentation is lacking and inheritance levels a dozen levels deep, it's great that community members can jump in to help each other -- it speaks volumes for the project.

当缺少文档并且继承层次很深时,社区成员可以互相帮助是一件很不错的事-它可以说是项目的重中之重。

翻译自:

mongodb 字段检索

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

你可能感兴趣的文章
CF1009F Dominant Indices - 题解
查看>>
memached实现tomcat的session共享
查看>>
django导出excel
查看>>
阿里云服务器CentOS6.9安装maven
查看>>
【搜索】数的划分
查看>>
智能提示
查看>>
[JavaScript] 弹出编辑框
查看>>
一个消息队列MQ调试工具
查看>>
springmvc 访问时找不到配置文件
查看>>
采访吴岳师兄有感 by 王宇飞
查看>>
LVS简略介绍
查看>>
hdu 1021 Fibonacci Again
查看>>
JVM架构_XmnXmsXmxXss有什么区别:转
查看>>
PHPExcel 使用心得
查看>>
洛谷 P3374 【模板】树状数组 1(单点加,区间和)
查看>>
verilog 代码编写小记
查看>>
PyQT的安装和配置
查看>>
从 docker 到 runC
查看>>
python基础学习笔记(十一)
查看>>
守护进程
查看>>