# Zugriff auf das Array über den Context

**URL:** <https://forum.shopware.com/t/zugriff-auf-das-array-ueber-den-context/99650>\
**Category:** Shopware 6 (German)\
**Tags:** general, programming, templates--design, themes--design, offizielle-shopware-\
**Created:** [11. Mai 2023 um 00:18 UTC](https://forum.shopware.com/t/zugriff-auf-das-array-ueber-den-context/99650 "2023-05-11T00:18:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shopwarer1638](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@shopwarer1638](https://forum.shopware.com/u/shopwarer1638)\
**Post date:** [11. Mai 2023 um 00:18 UTC](https://forum.shopware.com/t/zugriff-auf-das-array-ueber-den-context/99650/1 "2023-05-11T00:18:52Z")

</div>

Wie kann ich über den Kontext auf das Array zugreifen? Es funktioniert nicht mit $array1 jetzt, es gibt null zurück:

```auto
public function handleRequest(ProductListingCriteriaEvent $event): void
{
    $event->getCriteria()->addAssociation('properties');
    $event->getCriteria()->addAssociation('properties.group');

    $array1 = array ($event->getContext()->getExtension('currentPropertyHersteller'));

    if (in_array('c0d02d1712fd4293a489695787e06b5c', $array1)) {
        // $criteria->addFilter(new MultiFilter...
    }
}

public function handleResult(ProductListingResultEvent $event): void
{
    $currentPropertyHersteller = array ($properties->getCurrentFilter('properties'));

    $event->getContext()->addExtension('currentPropertyHersteller', new ArrayEntity($currentPropertyHersteller));
}

```
