|
Revision 3203, 1.6 kB
(checked in by fabien, 6 years ago)
|
- added phpdoc to the config/ files
- renamed sfLoader::getConfigDirs() to sfLoader::getConfigPaths()
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id Rev Date
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
class sfRoutingConfigHandler extends sfYamlConfigHandler |
|---|
| 18 |
{ |
|---|
| 19 |
|
|---|
| 20 |
* Executes this configuration handler. |
|---|
| 21 |
* |
|---|
| 22 |
* @param array An array of absolute filesystem path to a configuration file |
|---|
| 23 |
* |
|---|
| 24 |
* @return string Data to be written to a cache file |
|---|
| 25 |
* |
|---|
| 26 |
* @throws sfConfigurationException If a requested configuration file does not exist or is not readable |
|---|
| 27 |
* @throws sfParseException If a requested configuration file is improperly formatted |
|---|
| 28 |
*/ |
|---|
| 29 |
public function execute($configFiles) |
|---|
| 30 |
{ |
|---|
| 31 |
|
|---|
| 32 |
$config = $this->parseYamls($configFiles); |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
$routes = sfRouting::getInstance(); |
|---|
| 36 |
foreach ($config as $name => $params) |
|---|
| 37 |
{ |
|---|
| 38 |
$routes->connect( |
|---|
| 39 |
$name, |
|---|
| 40 |
($params['url'] ? $params['url'] : '/'), |
|---|
| 41 |
(isset($params['param']) ? $params['param'] : array()), |
|---|
| 42 |
(isset($params['requirements']) ? $params['requirements'] : array()) |
|---|
| 43 |
); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
$retval = sprintf("<?php\n". |
|---|
| 48 |
"// auto-generated by sfRoutingConfigHandler\n". |
|---|
| 49 |
"// date: %s\n\$routes = sfRouting::getInstance();\n\$routes->setRoutes(\n%s\n);\n", |
|---|
| 50 |
date('Y/m/d H:i:s'), var_export($routes->getRoutes(), 1)); |
|---|
| 51 |
|
|---|
| 52 |
return $retval; |
|---|
| 53 |
} |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|