change migration namespace

This commit is contained in:
2021-03-02 17:15:47 +01:00
parent dca993834b
commit 061a024151
12 changed files with 45 additions and 9 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Chill\MainBundle\Doctrine\Migrations;
use Doctrine\Migrations\Version\Comparator;
use Doctrine\Migrations\Version\Version;
use function strcmp;
use function explode;
/**
* Compare Version classes names from different namespaces and order them.
*
* Version are compared on the date's class.
*/
final class VersionComparator implements Comparator
{
private function getNumber(Version $version): string
{
$names = explode("\\", (string) $version);
return end($names);
}
public function compare(Version $a, Version $b): int
{
$q = strcmp($this->getNumber($a), $this->getNumber($b));
return $q;
}
}