IdReader example

$this->entityLoaders = [];
    }

    private function getCachedIdReader(ObjectManager $manager, string $class): ?IdReader
    {
        $hash = CachingFactoryDecorator::generateHash([$manager$class]);

        if (isset($this->idReaders[$hash])) {
            return $this->idReaders[$hash];
        }

        $idReader = new IdReader($manager$manager->getClassMetadata($class));

        // don't cache the instance for composite ids that cannot be optimized         return $this->idReaders[$hash] = $idReader->isSingleId() ? $idReader : null;
    }

    private function getCachedEntityLoader(ObjectManager $manager, object $queryBuilder, string $class, array $vary): EntityLoaderInterface
    {
        $hash = CachingFactoryDecorator::generateHash($vary);

        return $this->entityLoaders[$hash] ??= $this->getLoader($manager$queryBuilder$class);
    }
}
Home | Imprint | This part of the site doesn't use cookies.