Open up Paginator::$documents for read
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 45/100
调研方向
从 Elasticsearch\Paginator 类开始,检查 Hydra 集合规范化器如何使用其文档。使用 issue 中的 decorator 示例,验证无需替换原生 provider 即可读取 Elasticsearch 聚合;当文档保持只读但可公开访问时,这项工作就完成了。
由索引模型根据 Issue 内容生成。
描述
Description
In Elasticsearch\Paginator, the results of the query stored in $this->documents are private readonly.
Since the property is readonly anyway, would you be willing to make it public readonly?
A lot of the time, Elasticsearch returns metadata such as aggregations, necessary for building feature-rich search experiences.
It is a total waste of time to implement a custom Elasticsearch provider. The native one is great and does a lot of heavy lifting. If the property was open for read, I could simply decorate the normalizer, see example.
Example
#[AsDecorator('api_platform.hydra.normalizer.collection')]
class ElasticsearchNormalizer implements NormalizerInterface, NormalizerAwareInterface
{
public function __construct(
private NormalizerInterface $normalizer,
) {
}
public function normalize(mixed $object, string $format = null, array $context = []): array
{
if (!$object instanceof Elasticsearch\Paginator) {
throw new \LogicException();
}
return array_merge(
$this->normalizer->normalize($object, $format, $context), // produces a valid hydra:collection
['aggregations => $object->documents['aggregations']], // metadata returned by Elasticsearch read from the raw result
));
}
}
- 主要语言
- PHP
- 星标
- 2.6k
- 派生
- 988
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 108
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/core 的其他 Issue
-
SortFilter generates unsupported array form for parameters可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
api-platform/core#8744 ·
维护者通常 1 天内回复
-
JSON:API: resource schemas (`*.jsonapi`) have `properties` but no `type: object`可能已有人在做 @ousamabenyounes 于 8 天前认领。 未关闭
难度 2/5 1 小时以内 新手友好度 80/100
api-platform/core#8701 ·
维护者通常 1 天内回复
-
[Json-Schema] Nested resources lost externalDoc and description data可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
api-platform/core#8721 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 50/100
api-platform/core#8704 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 62/100
api-platform/core#8703 ·
维护者通常 1 天内回复
查看 api-platform/core 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
backdrop-contrib/paragraphs#299 ·
-
tech-debt
难度 2/5 1-3 小时 新手友好度 78/100
landsman/adminer-desktop#206 ·
维护者通常 1 天内回复
-
Explosm: Cyanide & Happiness failed with: https://explosm.net/comics/latest#comic resulted in 307未关闭
难度 2/5 1-3 小时 新手友好度 72/100
RSS-Bridge/rss-bridge#5154 ·
维护者通常 1 天内回复
-
sync-en
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 2 天内回复