Tach zusammen,
ein Plugin fügt weitere Filterungen hinzu, was soweit ohne Problem läuft:
Shopware 6: Extending the storefront listing
Sobald ElasticSearch aktiviert wird, scheint folgenden Zeile Probleme zu machen:
public function handleRequest(ProductListingCriteriaEvent $event)
{
$criteria = $event->getCriteria();
$request = $event->getRequest();
// TODO, macht mit elasticsearch probleme
$criteria->addAggregation(
new EntityAggregation(
EnevDefinition::ENTITY_NAME,
'product.'.EnevDefinition::ENTITY_NAME.'.id',
EnevDefinition::ENTITY_NAME
)
);
...
}
Hier die Fehlermeldung:
[2020-10-19 11:48:01] php.CRITICAL: Uncaught Error: array_column() expects parameter 1 to be array, null given {"exception":"[object] (TypeError(code: 0): array_column() expects parameter 1 to be array, null given at /var/www/shopware.cologne/vendor/shopware/elasticsearch/Framework/DataAbstractionLayer/ElasticsearchEntityAggregatorHydrator.php:122)"} []
[2020-10-19 11:48:01] request.CRITICAL: Uncaught PHP Exception TypeError: "array_column() expects parameter 1 to be array, null given" at /var/www/shopware.cologne/vendor/shopware/elasticsearch/Framework/DataAbstractionLayer/ElasticsearchEntityAggregatorHydrator.php line 122 {"exception":"[object] (TypeError(code: 0): array_column() expects parameter 1 to be array, null given at /var/www/shopware.cologne/vendor/shopware/elasticsearch/Framework/DataAbstractionLayer/ElasticsearchEntityAggregatorHydrator.php:122)"} []
Das Plugin fügt dem Product zusätzlich die “extendFields”
Shopware 6: Entity extension
hinzu:
public function extendFields(FieldCollection $collection): void
{
$collection->add(
(new OneToManyAssociationField(
EnevDefinition::ENTITY_NAME,
EnevDefinition::class,
'product_id',
'id'
))
);
}
Kann mir jemand weiterhelfen?