. */ namespace Doctrine\DBAL\Migrations\Configuration; use Symfony\Component\Yaml\Yaml; /** * Load migration configuration information from a YAML 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 YamlConfiguration extends AbstractFileConfiguration { /** * @inheritdoc */ protected function doLoad($file) { $array = Yaml::parse($file); if (isset($array['name'])) { $this->setName($array['name']); } if (isset($array['table_name'])) { $this->setMigrationsTableName($array['table_name']); } if (isset($array['migrations_namespace'])) { $this->setMigrationsNamespace($array['migrations_namespace']); } if (isset($array['migrations_directory'])) { $migrationsDirectory = $this->getDirectoryRelativeToFile($file, $array['migrations_directory']); $this->setMigrationsDirectory($migrationsDirectory); $this->registerMigrationsFromDirectory($migrationsDirectory); } if (isset($array['migrations']) && is_array($array['migrations'])) { foreach ($array['migrations'] as $migration) { $this->registerMigration($migration['version'], $migration['class']); } } } }