PHP Class Webmozart\Json\Migration\MigrationManager

The JSON object is expected to have the property "version" set.
Since: 1.3
Author: Bernhard Schussek ([email protected])
Mostrar archivo Open project: webmozart/json Class Usage Examples

Public Methods

Method Description
__construct ( array $migrations, Webmozart\Json\Versioning\JsonVersioner $versioner = null ) Creates a new migration manager.
getKnownVersions ( ) : string[] Returns all versions known to the manager.
migrate ( stdClass $data, string $targetVersion ) Migrates a JSON object to the given version.

Private Methods

Method Description
down ( $data, $sourceVersion, $targetVersion )
up ( $data, $sourceVersion, $targetVersion )

Method Details

__construct() public method

Creates a new migration manager.
public __construct ( array $migrations, Webmozart\Json\Versioning\JsonVersioner $versioner = null )
$migrations array The migrations migrating a JSON object between individual versions
$versioner Webmozart\Json\Versioning\JsonVersioner The versioner that should be used

getKnownVersions() public method

Returns all versions known to the manager.
public getKnownVersions ( ) : string[]
return string[] The known version strings

migrate() public method

Migrates a JSON object to the given version.
public migrate ( stdClass $data, string $targetVersion )
$data stdClass The JSON object
$targetVersion string The version string