/**
  * @param string $class
  *
  * @return mixed
  */
 protected function getMetadata($class)
 {
     if (array_key_exists($class, $this->cache)) {
         return $this->cache[$class];
     }
     $this->cache[$class] = null;
     foreach ($this->registry->getManagers() as $dm) {
         try {
             return $this->cache[$class] = $dm->getClassMetadata($class);
         } catch (MappingException $e) {
             // not an entity or mapped super class
         }
     }
 }