You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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')]
classElasticsearchNormalizerimplementsNormalizerInterface, NormalizerAwareInterface
{
publicfunction__construct(
privateNormalizerInterface$normalizer,
) {
}
publicfunctionnormalize(mixed$object, string$format = null, array$context = []): array
{
if (!$object instanceof Elasticsearch\Paginator) {
thrownew \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
));
}
}
The text was updated successfully, but these errors were encountered:
Description
In
Elasticsearch\Paginator
, the results of the query stored in$this->documents
areprivate 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
The text was updated successfully, but these errors were encountered: