private function appendMapping(QueryBuilder $queryBuilder, MappingInterface $mapping, $locale, $locales)
    {
        if ($mapping->onlyPublished()) {
            $queryBuilder->andWhere(
                $this->qomFactory->comparison(
                    $this->qomFactory->propertyValue(
                        'node',
                        $this->propertyEncoder->localizedSystemName('state', $locale)
                    ),
                    '=',
                    $this->qomFactory->literal(WorkflowStage::PUBLISHED)
                )
            );
        }

        $properties = $mapping->getProperties();
        foreach ($properties as $propertyName) {
            $this->appendSingleMapping($queryBuilder, $propertyName, $locales);
        }

        if ($mapping->resolveUrl()) {
            $this->appendUrlMapping($queryBuilder, $locales);
        }
    }