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

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

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

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

        $this->idService->generateCustomId($entity);
    }
public function prePersist ( LifecycleEventArgs $ args ) { $ entity = $ args -> getEntity ( ) ; if ( ! $ entity instanceof CustomIdentifiable ) { return ; } $ this -> idService -> generateCustomId ( $ entity ) ; }
Generate a custom id before persisting the entity, if none provided

@param \Doctrine\ORM\Event\LifecycleEventArgs $args
Generate a custom id before persisting the entity if none provided