src/Service/CacheKeyBuilder.php
public function getEntityIdentifier($entity)
    {
        if (!($this->doctrine instanceof Registry)) {
            return null;
        }

        $ids = $this
            ->doctrine
            ->getManager()
            ->getClassMetadata(get_class($entity))
            ->getIdentifierValues($entity);

        return $ids ? self::IDENTIFIER_PREFIX.implode(self::IDENTIFIER_SEPARATOR, $ids) : null;
    }
public function getEntityIdentifier($entity)
    {
        if (!($this->doctrine instanceof Registry)) {
            return null;
        }

        $ids = $this
            ->doctrine
            ->getManager()
            ->getClassMetadata(get_class($entity))
            ->getIdentifierValues($entity);

        return $ids ? self::IDENTIFIER_PREFIX.implode(self::IDENTIFIER_SEPARATOR, $ids) : null;
    }
@param object $entity

@return string|null