You are here

public function MappingDriverChain::loadMetadataForClass in Plug 7

Loads the metadata for the specified class into the provided container.

Parameters

string $className:

ClassMetadata $metadata:

Return value

void

Overrides MappingDriver::loadMetadataForClass

File

lib/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php, line 97

Class

MappingDriverChain
The DriverChain allows you to add multiple other mapping drivers for certain namespaces.

Namespace

Doctrine\Common\Persistence\Mapping\Driver

Code

public function loadMetadataForClass($className, ClassMetadata $metadata) {

  /* @var $driver MappingDriver */
  foreach ($this->drivers as $namespace => $driver) {
    if (strpos($className, $namespace) === 0) {
      $driver
        ->loadMetadataForClass($className, $metadata);
      return;
    }
  }
  if (null !== $this->defaultDriver) {
    $this->defaultDriver
      ->loadMetadataForClass($className, $metadata);
    return;
  }
  throw MappingException::classNotFoundInNamespaces($className, array_keys($this->drivers));
}