/**
  * Gets directories where model classes are stored.
  *
  * @return array An array of directories
  */
 public function getModelDirs()
 {
     // if there is a configuration dimension
     if ($this->hasDimension()) {
         // if there is a cache return it
         if ($this->dimension->getCache()->has('sf_model_dirs')) {
             return $this->dimension->getCache()->get('sf_model_dirs');
         } else {
             $dimensions = array_reverse($this->dimension->getCascade());
             $dirs = array(sfConfig::get('sf_lib_dir') . '/model');
             // project
             // extend base dirs and add dimension cascade, checking dir exists
             foreach ($dimensions as $dimension) {
                 if (is_readable($dirs[0] . '/' . $dimension)) {
                     array_unshift($dirs, $dirs[0] . '/' . $dimension);
                 }
             }
             if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir') . '/*/lib/model')) {
                 foreach ($pluginDirs as $dir) {
                     // extend base dirs and add dimension cascade, checking dir exists
                     foreach ($dimensions as $dimension) {
                         if (is_readable($dir . '/' . $dimension)) {
                             array_unshift($pluginDirs, $dir . '/' . $dimension);
                         }
                     }
                 }
                 $dirs = array_merge($dirs, $pluginDirs);
                 // plugins
             }
             // save cache
             $this->dimension->getCache()->set('sf_model_dirs', $dirs);
         }
     } else {
         $dirs = parent::getModelDirs();
     }
     return $dirs;
 }