original_string: public function prePersist(LifecycleEventArgs $args)
      {
          $entity        = $args->getEntity();
          $entityManager = $args->getEntityManager();
  
          $classMetadata = $entityManager->getClassMetadata(get_class($entity));
  
          if (false == $this->isModular($classMetadata)) {
              return;
          }
  
          if (null === $entity->getModule() && null !== $this->getModuleManager()->getCurrentModule()) {
              $entity->setModule($this->getModuleManager()->getCurrentModule());
          }
      }
code: public function prePersist(LifecycleEventArgs $args)
      {
          $entity        = $args->getEntity();
          $entityManager = $args->getEntityManager();
  
          $classMetadata = $entityManager->getClassMetadata(get_class($entity));
  
          if (false == $this->isModular($classMetadata)) {
              return;
          }
  
          if (null === $entity->getModule() && null !== $this->getModuleManager()->getCurrentModule()) {
              $entity->setModule($this->getModuleManager()->getCurrentModule());
          }
      }
code_tokens: public function prePersist ( LifecycleEventArgs $ args ) { $ entity = $ args -> getEntity ( ) ; $ entityManager = $ args -> getEntityManager ( ) ; $ classMetadata = $ entityManager -> getClassMetadata ( get_class ( $ entity ) ) ; if ( false == $ this -> isModular ( $ classMetadata ) ) { return ; } if ( null === $ entity -> getModule ( ) && null !== $ this -> getModuleManager ( ) -> getCurrentModule ( ) ) { $ entity -> setModule ( $ this -> getModuleManager ( ) -> getCurrentModule ( ) ) ; } }
docstring: Handles actions before creation of an entity.
  
  Sets the module of an entity to the current module defined
  by the module manager if it has been left empty.
  
  @param LifecycleEventArgs $args
docstring_tokens: Handles actions before creation of an entity .