public function transform($entity)
    {
        if (null === $entity) {
            return '';
        }
        if (!is_subclass_of($entity, $this->entityClass)) {
            throw new \InvalidArgumentException(sprintf(
                'Unsupported entity "%s" into "%s" loader.',
                get_class($entity),
                __CLASS__
            ));
        }

        return $entity->getId();
    }