Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit cbe839a

Browse files
authored
Merge pull request #1760 from Vinai/patch-16
Add getDependencies method name to example.
2 parents df70ba4 + ced8897 commit cbe839a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

guides/v2.3/extension-dev-guide/declarative-schema/data-patches.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ The declarative schema approach removes the version from the `setup_module` tabl
1515

1616
The sequence of installing patches is handled through a dependency-based approach. Patches can either be independent or dependent on other patches. Independent patches can be installed in any sequence. A dependent patch requires a minimal number of patches so that it can be installed successfully.
1717

18-
To define a dependency in a patch, make a static reference to the patch class. The class can be in any module.
18+
To define a dependency in a patch, add the method `public static function getDependencies()`
19+
to the patch class and return the class names of the patches this patch depends on. The dependency can be in any module.
1920

2021
``` php
21-
return [
22-
\SomeVendor\SomeModule\Setup\Patch\Data\SomePatch::class
23-
];
22+
public static function getDependencies()
23+
{
24+
return [
25+
\SomeVendor\SomeModule\Setup\Patch\Data\SomePatch::class
26+
];
27+
}
2428
```
2529

2630
The following code sample defines a data patch class that has a dependency.

0 commit comments

Comments
 (0)