/**
  * Loads database configuration.
  */
 public function loadConfiguration()
 {
     // http://qubit-toolkit.org/wiki/index.php?title=Config
     $config = (include sfConfig::get('sf_config_dir') . '/config.php');
     $config = sfYamlConfigHandler::flattenConfigurationWithEnvironment($config);
     foreach ($config as $name => $database) {
         $this->setDatabase($name, new $database['class']($database['param']));
     }
 }
Ejemplo n.º 2
0
 protected function execute($arguments = array(), $options = array())
 {
     if (!isset($options['dir']) || $options['dir'] !== sfConfig::get('sf_root_dir')) {
         $options['dir'] = sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . $options['dir'];
     }
     $this->logSection('Scanning folder ' . $options['dir'], '');
     $permission_files = sfFinder::type('file')->maxdepth($options['depth'])->name('permissions.yml')->in($options['dir']);
     if (empty($permission_files)) {
         $this->logSection('Search response : ', 'no ' . $options['filenameformat'] . ' file found.');
         return;
     }
     $permissions = array();
     foreach ($permission_files as $file_path) {
         $permissions = array_merge($permissions, sfYamlConfigHandler::parseYaml($file_path));
     }
     var_dump($permissions);
     die;
     $this->logSection('Searching for new permissions', '');
     $new_permissions = $this->cleanPermissionsArrayFromAlreadyPresentPermissions($permissions);
     if (empty($new_permissions)) {
         $this->logSection('No new permission.', '');
         return;
     }
 }
Ejemplo n.º 3
0
 public function getConfigValue($keyName, $category, $defaultValue = null)
 {
     return parent::getConfigValue($keyName, $category, $defaultValue);
 }
 private function loadSchema($options)
 {
     if ($options['schema_type'] == 'xml') {
         $sfPropelSchemaToYmlTask = new sfPropelSchemaToYmlTask($this->dispatcher, $this->formatter);
         $sfPropelSchemaToYmlTask->run();
         $ymlfile = sfYamlConfigHandler::parseYaml(sfConfig::get('sf_config_dir') . "/schema.yml");
     } else {
         if ($options['schema_type'] == 'yml') {
             $ymlfile = sfYamlConfigHandler::parseYaml(sfConfig::get('sf_config_dir') . "/schema.yml");
         } else {
             throw new Exception('Schema type not recognized.');
         }
     }
     return $ymlfile;
 }