feat: read BusProNet base data from the MyE&P API
This commit is contained in:
1 parent
1505f9b50b
commit
2e9328fc51
37 files changed
+2302
-148
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Moves destination.country from the raw BusProNet abbreviations to lowercase ISO-2.
|
||||
*
|
||||
* The column used to hold whatever BusProNet reported as hotel/land, lowercased: a,
|
||||
* ch, d, f, i, nl. That set is not a standard - the same country appears as A, AT and
|
||||
* AUT upstream - so the import now stores the ISO code MyE&P resolves instead, and the
|
||||
* existing rows are converted to match. The flag icons and the country filters use the
|
||||
* same vocabulary and are switched with it.
|
||||
*/
|
||||
final class Version20260813120000 extends AbstractMigration
|
||||
{
|
||||
private const TO_ISO = [
|
||||
'a' => 'at',
|
||||
'd' => 'de',
|
||||
'f' => 'fr',
|
||||
'i' => 'it',
|
||||
];
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Convert destination.country to lowercase ISO-3166-1 alpha-2';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
foreach (self::TO_ISO as $legacy => $iso) {
|
||||
$this->addSql('UPDATE destination SET country = ? WHERE country = ?', [$iso, $legacy]);
|
||||
}
|
||||
|
||||
// ch and nl are already ISO; empty strings were never a country
|
||||
$this->addSql("UPDATE destination SET country = NULL WHERE country = ''");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
foreach (self::TO_ISO as $legacy => $iso) {
|
||||
$this->addSql('UPDATE destination SET country = ? WHERE country = ?', [$legacy, $iso]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user