code: public function preUpdate(PreUpdateEventArgs $args)
      {
          $entity = $args->getEntity();
  
          if (!$entity instanceof Parameter) {
              return;
          }
  
          $key = $entity->getKey();
          $encrypt = $this->parameterCollection->get($key)['encrypt'];
          $entity->setEncrypt($encrypt);
      }
docs: Set parameter entity encrypt property before saving in storage.
  
  @param \Doctrine\ORM\Event\PreUpdateEventArgs $args