/** * Gets the template to use for a generator class. * * @param string The generator class name * @param string The theme name * @param string The template path * * @return string A template path * * @throws sfException */ public function getGeneratorTemplate($class, $theme, $path) { // if there is a configuration dimension if ($this->hasDimension()) { $cacheKey = sprintf('sf_generator_templates_%s_%s_%s', $class, $theme, $path); // if there is a cache return it if ($this->dimension->getCache()->has($cacheKey)) { $dirs = $this->dimension->getCache()->get($cacheKey); } else { // otherwise create and store $dirs = $this->getGeneratorTemplateDirs($class, $theme); foreach ($dirs as $dir) { if (is_readable($dir . '/' . $path)) { // save cache $this->dimension->getCache()->set($cacheKey, $dir . '/' . $path); return $dir . '/' . $path; } } throw new sfException(sprintf('Unable to load "%s" generator template in: %s.', $path, implode(', ', $dirs))); } } else { $dirs = parent::getGeneratorTemplate($class, $theme, $path); } return $dirs; }