code: public function prePersist(LifecycleEventArgs $args)
      {
          $entity = $args->getEntity();
  
          if (!$entity instanceof Translatable) {
              return;
          }
  
          $this->translationService->transfer($entity);
      }
docs: Generate a custom id before persisting the entity, if none provided
  
  @param \Doctrine\ORM\Event\LifecycleEventArgs $args