code: public function toggleFiltrable($entityName, $id)
      {
          $entity = $this->entityManager->getRepository($entityName)->find($id);
  
          if (!$entity) {
              throw new NotFoundHttpException();
          }
  
          $entity->toggleFiltrable();
  
          $this->entityManager->persist($entity);
          $this->entityManager->flush();
  
          return $entity->isFiltrable();
      }
docs: Sets an entity as filtrable
  
  @param string $entityName
  @param int    $id
  
  @throws NotFoundHttpException
  @return boolean