File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -32,13 +32,15 @@ private function createMakeEntityTest(bool $withDatabase = true): MakerTestDetai
32
32
->preRun (function (MakerTestRunner $ runner ) use ($ withDatabase ) {
33
33
$ config = $ runner ->readYaml ('config/packages/doctrine.yaml ' );
34
34
35
- if (isset ($ config ['doctrine ' ]['orm ' ]['mappings ' ]['App ' ]['type ' ]) && $ this ->useAttributes ($ runner )) {
36
- // use attributes
37
- $ runner ->replaceInFile (
38
- 'config/packages/doctrine.yaml ' ,
39
- 'type: annotation ' ,
40
- 'type: attribute '
41
- );
35
+ /* @legacy Refactor when annotations are no longer supported. */
36
+ if (isset ($ config ['doctrine ' ]['orm ' ]['mappings ' ]['App ' ]) && !$ this ->useAttributes ($ runner )) {
37
+ // Attributes are only supported w/ PHP 8, FrameworkBundle >=5.2,
38
+ // ORM >=2.9, & DoctrineBundle >=2.4
39
+ $ runner ->modifyYamlFile ('config/packages/doctrine.yaml ' , function (array $ data ) {
40
+ $ data ['doctrine ' ]['orm ' ]['mappings ' ]['App ' ]['type ' ] = 'annotation ' ;
41
+
42
+ return $ data ;
43
+ });
42
44
}
43
45
44
46
if ($ withDatabase ) {
You can’t perform that action at this time.
0 commit comments