Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory::getAllMetadata PHP Method

getAllMetadata() public method

Forces the factory to load the metadata of all classes known to the underlying mapping driver.
public getAllMetadata ( ) : array
return array The ClassMetadata instances of all mapped classes.
    public function getAllMetadata()
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $driver = $this->getDriver();
        $metadata = [];
        foreach ($driver->getAllClassNames() as $className) {
            $metadata[] = $this->getMetadataFor($className);
        }
        return $metadata;
    }

Usage Example

 public function getAllMetadata()
 {
     static $mapKey = 'maps\\$XMLCLASSMAPS';
     if ($this->allLoaded) {
         return;
     }
     $mapData = $this->getCacheDriver()->fetch($mapKey);
     if (!empty($mapData)) {
         $this->xmlToClassMap = $mapData['xmlToClassMap'];
         $this->wrapperXmlToClassMap = $mapData['wrapperXmlToClassMap'];
         $this->alternativeClassMap = $mapData['alternativeClassMap'];
         $this->attributesClassMap = $mapData['attributesClassMap'];
         $result = TRUE;
     } else {
         $result = parent::getAllMetadata();
         $mapData = $this->getCacheDriver()->save($mapKey, array('xmlToClassMap' => $this->xmlToClassMap, 'wrapperXmlToClassMap' => $this->wrapperXmlToClassMap, 'alternativeClassMap' => $this->alternativeClassMap, 'attributesClassMap' => $this->attributesClassMap));
     }
     $this->allLoaded = TRUE;
     return $result;
 }