private function evaluateMapping(
        LoadEntity $annotation,
        string $entityNamespace
    ) {
        if (!empty($annotation->getMapping())) {
            $mapping = $annotation->getMapping();
            $mappingFallback = !is_null($annotation->getMappingFallback())
                ? $annotation->getMappingFallback()
                : $this->mappingFallback;

            /**
             * Each value of the mapping array is computed and analyzed.
             *
             * If the format is something like %value%, this service will
             * look for the real request attribute value
             */
            foreach ($mapping as $mappingKey => $mappingValue) {
                $parameterValue = $this
                    ->providerCollector
                    ->provide($mappingValue);

                /**
                 * Defined field is not found in current route, and we have
                 * enabled the "mapping fallback" setting. In that case we
                 * assume that the mapping definition is wrong, and we return
                 * the entity itself.
                 */
                if ($mappingFallback && ($parameterValue === $mappingValue)) {
                    return null;
                }

                $mapping[$mappingKey] = $parameterValue;
            }

            $instance = $this
                ->resolveRepositoryLookup(
                    $annotation,
                    $entityNamespace,
                    $mapping
                );

            if (!$instance instanceof $entityNamespace) {
                throw new EntityNotFoundException(
                    'Entity of type ' . $entityNamespace . ' with mapping ' .
                    json_encode($mapping) . ' was not found.'
                );
            }

            return $instance;
        }

        return null;
    }