Form/Type/ResourceType.php
protected function getIdentifierValue(ResourceInterface $originalData)
    {
        $class = ClassUtils::getClass($originalData);
        $entityManager = $this->doctrine->getManagerForClass($class);
        if (!$entityManager instanceof EntityManagerInterface) {
            throw new \InvalidArgumentException("No manager found for class {$class}");
        }
        $metadata = $entityManager->getClassMetadata($class);
        $identifier = $metadata->getIdentifierValues($originalData);
        if (1 !== \count($identifier)) {
            throw new \LogicException('ResourceInterface must have a single identifier (primary key)');
        }

        return array_pop($identifier);
    }
protected function getIdentifierValue(ResourceInterface $originalData)
    {
        $class = ClassUtils::getClass($originalData);
        $entityManager = $this->doctrine->getManagerForClass($class);
        if (!$entityManager instanceof EntityManagerInterface) {
            throw new \InvalidArgumentException("No manager found for class {$class}");
        }
        $metadata = $entityManager->getClassMetadata($class);
        $identifier = $metadata->getIdentifierValues($originalData);
        if (1 !== \count($identifier)) {
            throw new \LogicException('ResourceInterface must have a single identifier (primary key)');
        }

        return array_pop($identifier);
    }
@param ResourceInterface $originalData

@throws \InvalidArgumentException
@throws \LogicException

@return array