private function getLegacyMigrationDefinition($version, $bundle)
    {
        if (!isset($this->activeBundles[$bundle])) {
            return false;
        }

        $versionsDir = $this->activeBundles[$bundle] . '/' . $this->legacyMigrationsDir;
        $versionDefinitions = glob($versionsDir . "/$version*");

        if (!is_array($versionDefinitions)) {
            return false;
        }

        foreach ($versionDefinitions as $key => $versionDefinition) {
            if (!in_array(pathinfo($versionDefinition, PATHINFO_EXTENSION), array('php', 'yml', 'sql'))) {
                unset($versionDefinitions[$key]);
            }
        }

        if (empty($versionDefinitions)) {
            return false;
        }

        return $versionDefinitions[0];
    }