src/Identity/EventListener/Entity/IdentitiableListener.php
public function prePersist(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if (!$entity instanceof Identitiable) {
            return;
        }

        $this->identityService->generateIdentity($entity);
    }
public function prePersist(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if (!$entity instanceof Identitiable) {
            return;
        }

        $this->identityService->generateIdentity($entity);
    }
Assign the current session identity, if none provided

@param \Doctrine\ORM\Event\LifecycleEventArgs $args