@@ -2,20 +2,23 @@ PHPCR Migrations Bundle
2
2
=======================
3
3
4
4
This library provides a Symfony integration for the [ PHPCR migrations
5
- library] ( https://github.com/dantleech/phpcr-migrations ) .
5
+ library] ( https://github.com/phpcr/phpcr-migrations ) .
6
+
7
+ It has initially been created by Daniel Leech as ` dantleech/phpcr-migrations-bundle ` and was then
8
+ donated to the PHPCR organization.
6
9
7
10
Configuration
8
11
-------------
9
12
10
13
Configure the path to your migrations:
11
14
12
15
```` yaml
13
- # app/ config.yml
16
+ # config/packages/phpcr-migrations.yaml
14
17
phpcr_migrations :
15
- paths : [%kernel.root_dir %/phpcr-migrations]
18
+ paths : [%kernel.project_dir %/phpcr-migrations]
16
19
` ` ` `
17
20
18
- Or the bundle will automatically pick up any migrations in the
21
+ And the bundle will automatically pick up any migrations in the
19
22
` Resources/phpcr-migrations` folder in any bundles registered in the kernel.
20
23
21
24
Creating migrations
@@ -25,19 +28,19 @@ First create two new migration files:
25
28
26
29
` ` ` ` php
27
30
<?php
28
- // app/ phpcr-migrations/Version201501011200.php
31
+ // phpcr-migrations/Version201501011200.php
29
32
30
33
use PHPCR\SessionInterface;
31
34
use PHPCR\Migrations\VersionInterface;
32
35
33
36
class Version201501011200 implements VersionInterface
34
37
{
35
- public function up(SessionInterface $session)
38
+ public function up(SessionInterface $session) : void
36
39
{
37
40
$session->getRootNode()->addNode('hello');
38
41
}
39
42
40
- public function down(SessionInterface $session)
43
+ public function down(SessionInterface $session) : void
41
44
{
42
45
$session->getRootNode()->getNode('hello')->remove();
43
46
}
@@ -55,12 +58,12 @@ use PHPCR\Migrations\VersionInterface;
55
58
56
59
class Version201501011212 implements VersionInterface
57
60
{
58
- public function up(SessionInterface $session)
61
+ public function up(SessionInterface $session): void
59
62
{
60
63
$session->getNode('/hello')->addNode('world');
61
64
}
62
65
63
- public function down(SessionInterface $session)
66
+ public function down(SessionInterface $session): void
64
67
{
65
68
$session->getNode('/hello')->getNode('world')->remove();
66
69
}
@@ -99,7 +102,7 @@ Upgrading 2 version(s):
99
102
+ [2/2]: 201501011212
100
103
````
101
104
102
- This should run the two migrations, your status should not look like this:
105
+ This should run the two migrations.
103
106
104
107
Reverting
105
108
---------
@@ -129,4 +132,3 @@ Actions are:
129
132
- ` down ` : Revert one version
130
133
- ` top ` : Migrate to the latest version
131
134
- ` bottom ` : Revert all migrations
132
-
0 commit comments