You are here

protected function FileDriver::initialize in Plug 7

Initializes the class cache from all the global files.

Using this feature adds a substantial performance hit to file drivers as more metadata has to be loaded into memory than might actually be necessary. This may not be relevant to scenarios where caching of metadata is in place, however hits very hard in scenarios where no caching is used.

Return value

void

3 calls to FileDriver::initialize()
FileDriver::getAllClassNames in lib/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php
Gets the names of all mapped classes known to this driver.
FileDriver::getElement in lib/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php
Gets the element of schema meta data for the class from the mapping file. This will lazily load the mapping file if it is not loaded yet.
FileDriver::isTransient in lib/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php
Returns whether the class with the specified name should have its metadata loaded. This is only the case if it is either mapped as an Entity or a MappedSuperclass.

File

lib/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php, line 176

Class

FileDriver
Base driver for file-based metadata drivers.

Namespace

Doctrine\Common\Persistence\Mapping\Driver

Code

protected function initialize() {
  $this->classCache = array();
  if (null !== $this->globalBasename) {
    foreach ($this->locator
      ->getPaths() as $path) {
      $file = $path . '/' . $this->globalBasename . $this->locator
        ->getFileExtension();
      if (is_file($file)) {
        $this->classCache = array_merge($this->classCache, $this
          ->loadMappingFile($file));
      }
    }
  }
}