. */ namespace Doctrine\DBAL\Migrations\Configuration; /** * Load migration configuration information from a XML configuration file. * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.org * @since 2.0 * @author Jonathan H. Wage */ class XmlConfiguration extends AbstractFileConfiguration { /** * @inheritdoc */ protected function doLoad($file) { $xml = simplexml_load_file($file); if (isset($xml->name)) { $this->setName((string) $xml->name); } if (isset($xml->table['name'])) { $this->setMigrationsTableName((string) $xml->table['name']); } if (isset($xml->{'migrations-namespace'})) { $this->setMigrationsNamespace((string) $xml->{'migrations-namespace'}); } if (isset($xml->{'migrations-directory'})) { $migrationsDirectory = $this->getDirectoryRelativeToFile($file, (string) $xml->{'migrations-directory'}); $this->setMigrationsDirectory($migrationsDirectory); $this->registerMigrationsFromDirectory($migrationsDirectory); } if (isset($xml->migrations->migration)) { foreach ($xml->migrations->migration as $migration) { $this->registerMigration((string) $migration['version'], (string) $migration['class']); } } } }