Skip to content

phpcr/phpcr-migrations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPCR Migrations

Migrations library for PHPCR influenced by Doctrine migrations.

For integration with Symfony see the PHPCR Migrations Bundle.

Usage

$storage = new VersionStorage($phpcrSession);
$finder = new VersionFinder(array('/path/to/migrations'));

$versions = $finder->getVersionCollection();
$migrator = new Migrator($session, $versionCollection, $storage);

$to = '201504241744';
$migrator->migrate($to);

Versions

Version classes contain up and down methods. The class is quite simple:

<?php

class Version201504241200 implements VersionInterface
{
    public function up(SessionInterface $session)
    {
        $session->doSomething();
    }

    public function down(SessionInterface $session)
    {
        $session->undoSomething();
    }
}

They must be named VersionYYYMMDDHHMM. If they are not so named, then they will not be detected.

About

PHPCR Migrations library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages