Doctrine\DBAL\Migrations\Configuration\Configuration::getRelativeVersion PHP Method

getRelativeVersion() public method

Returns the version with the specified offset to the specified version.
public getRelativeVersion ( $version, $delta ) : string | null
return string | null A version string, or null if the specified version is unknown or the specified delta is not within the list of available versions.
    public function getRelativeVersion($version, $delta)
    {
        if (empty($this->migrations)) {
            $this->registerMigrationsFromDirectory($this->getMigrationsDirectory());
        }
        $versions = array_map('strval', array_keys($this->migrations));
        array_unshift($versions, '0');
        $offset = array_search((string) $version, $versions);
        if ($offset === false || !isset($versions[$offset + $delta])) {
            // Unknown version or delta out of bounds.
            return null;
        }
        return $versions[$offset + $delta];
    }

Usage Example

 public function getRelativeVersion($version, $delta)
 {
     $this->doRegister();
     return parent::getRelativeVersion($version, $delta);
 }