public function matchRules(string $targetType, $targetValue): array
    {
        $query = $this->getRuleSelectQuery();
        $query
            ->innerJoin(
                'r',
                'ngbm_rule_target',
                'rt',
                $query->expr()->eq('r.id', 'rt.rule_id')
            )
            ->where(
                $query->expr()->eq('rd.enabled', ':enabled'),
                $query->expr()->eq('rt.type', ':target_type')
            )
            ->setParameter('target_type', $targetType, Type::STRING)
            ->setParameter('enabled', true, Type::BOOLEAN)
            ->addOrderBy('rd.priority', 'DESC');

        $this->applyStatusCondition($query, Value::STATUS_PUBLISHED, 'r.status');
        $this->applyStatusCondition($query, Value::STATUS_PUBLISHED, 'rt.status');

        if (!isset($this->targetHandlers[$targetType])) {
            throw TargetHandlerException::noTargetHandler('Doctrine', $targetType);
        }

        $this->targetHandlers[$targetType]->handleQuery($query, $targetValue);

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }