# CategoryConditionHandler wirft Fehler

**URL:** https://forum.shopware.com/t/categoryconditionhandler-wirft-fehler/62789
**Category:** Programmierung
**Created:** [4. November 2019 um 14:48 UTC](https://forum.shopware.com/t/categoryconditionhandler-wirft-fehler/62789 "2019-11-04T14:48:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hbee](https://avatars.discourse-cdn.com/v4/letter/h/f08c70/32.png) [@hbee](https://forum.shopware.com/u/hbee)
#### Post date: [4. November 2019 um 14:48 UTC](https://forum.shopware.com/t/categoryconditionhandler-wirft-fehler/62789/1 "2019-11-04T14:48:06Z")

</div>

hi, ich habe mir wie [hier](https://developers.shopware.com/developers-guide/shopware-5-search-bundle/#full-implementation-with-condition-(with-dbal)) beschrieben einen&nbsp;CategoryConditionHandler angelegt. Das funktioniert soweit im Listing. Wenn ich jetzt aber über die Suche gehe und dort dann einen Filter setze, wir dmir folgender Fehler geworfen:

```
Uncaught Doctrine\DBAL\Query\QueryException: The given alias 'productCategory2' is not unique in FROM and JOIN clause table. The currently registered aliases are: product, variant, avoidCustomerGroup, searchTable, productCategory2.

```

Hier meine Code

```
class CategoryConditionHandler implements ConditionHandlerInterface
{
    public function supportsCondition(ConditionInterface $condition)
    {
        return ($condition instanceof CategoryCondition);
    }
    public function generateCondition(
        ConditionInterface $condition,
        QueryBuilder $query,
        ShopContextInterface $context
    ) {
        $query->innerJoin(
            'product',
            's_articles_categories_ro',
            'productCategory2',
            'productCategory2.articleID = product.id
             AND productCategory2.categoryID IN (:category)'
        );
        $query->setParameter(
            ':category',
            $condition->getCategoryIds(),
            Connection::PARAM_INT_ARRAY
        );
        $query->andWhere('productAttribute.design_id IS NOT NULL');
    }
}

```

Hat jemand eine Idee? Es läuft eine Shopware 5.5.10
