/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $config = $this->getCliConfig(); if ($modelsToRemove = array_diff($this->getFileModels($config['models_path']), $this->getYamlModels($config['yaml_schema_path']))) { $deleteModelFiles = new sfDoctrineDeleteModelFilesTask($this->dispatcher, $this->formatter); $deleteModelFiles->setCommandApplication($this->commandApplication); $deleteModelFiles->setConfiguration($this->configuration); $deleteModelFiles->run($modelsToRemove, array('no-confirmation' => $options['no-confirmation'])); $this->reloadAutoload(); } else { $this->logSection('doctrine', 'Could not find any models that need to be removed'); } }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $config = $this->getCliConfig(); $changed = false; $deleteModelFiles = new sfDoctrineDeleteModelFilesTask($this->dispatcher, $this->formatter); $deleteModelFiles->setCommandApplication($this->commandApplication); $deleteModelFiles->setConfiguration($this->configuration); $yamlSchema = $this->getYamlSchema($config['yaml_schema_path']); // remove any models present in the filesystem but not in the yaml schema if ($modelsToRemove = array_diff($this->getFileModels($config['models_path']), array_keys($yamlSchema))) { $deleteModelFiles->run($modelsToRemove, array('no-confirmation' => $options['no-confirmation'])); $changed = true; } // remove form classes whose generation is disabled foreach ($yamlSchema as $model => $definition) { if (isset($definition['options']['symfony']['form']) && !$definition['options']['symfony']['form'] && class_exists($model . 'Form')) { $deleteModelFiles->run(array($model), array('suffix' => array('Form'), 'no-confirmation' => $options['no-confirmation'])); $changed = true; } if (isset($definition['options']['symfony']['filter']) && !$definition['options']['symfony']['filter'] && class_exists($model . 'FormFilter')) { $deleteModelFiles->run(array($model), array('suffix' => array('FormFilter'), 'no-confirmation' => $options['no-confirmation'])); $changed = true; } } if ($changed) { $this->reloadAutoload(); } else { $this->logSection('doctrine', 'Could not find any files that need to be removed'); } }
private function _deletePluginFiles() { $this->logSection('sympal', 'Removing plugin files'); Doctrine_Lib::removeDirectories($this->_pluginPath); if ($this->_contentTypeName) { chdir(sfConfig::get('sf_root_dir')); $task = new sfDoctrineDeleteModelFilesTask($this->_dispatcher, $this->_formatter); foreach ($this->getPluginModels() as $model) { $task->run(array($model), array('--no-confirmation')); } } $path = sfConfig::get('sf_lib_dir') . '/*/doctrine/' . $this->_pluginName; $dirs = glob($path); sfToolkit::clearGlob($path); foreach ($dirs as $dir) { Doctrine_Lib::removeDirectories($dir); } if ($this->hasWebDirectory()) { unlink(sfConfig::get('sf_web_dir') . '/' . $this->_pluginName); } }