public function handleExcludeField(EventInterface $event)
    {
        /** @var \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata */
        $metadata    = $event->getParam('metadata');
        $identifiers = $metadata->getIdentifierFieldNames();

        return in_array($event->getParam('name'), $identifiers) &&
               ($metadata->generatorType === ClassMetadata::GENERATOR_TYPE_IDENTITY ||
                $metadata->generatorType === ClassMetadata::GENERATOR_TYPE_CUSTOM);
    }