Override Doctrine ODM mapping for Symfony FOSUserBundle
          
  
    
    
    
      
      
      
        
        
          less than 1 minute read
        
      
    
  
        
      
      
        
        In Symfony Cookbook How to Override any Part of a Bundle, it is written that you cannot override entity mappings and only attributes can be modified in superclasses. However, it is possible to hack you way through and register an Event Listener on loadClassMetadata that will rewrite the mapping on-the-fly. I would not qualify this as a good approach, but it is the only way I found.
A similar solution can be used for Doctrine ORM.
Here is an example, removing the uniqueness on emailCanonical of FOSUserBundle: