File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ private function createMakeEntityTest(bool $withDatabase = true): MakerTestDetai
30
30
{
31
31
return $ this ->createMakerTest ()
32
32
->preRun (function (MakerTestRunner $ runner ) use ($ withDatabase ) {
33
- if ($ this ->useAttributes ($ runner )) {
33
+ $ config = $ runner ->readYaml ('config/packages/doctrine.yaml ' );
34
+
35
+ if (isset ($ config ['doctrine ' ]['orm ' ]['mappings ' ]['App ' ]['type ' ]) && $ this ->useAttributes ($ runner )) {
34
36
// use attributes
35
37
$ runner ->replaceInFile (
36
38
'config/packages/doctrine.yaml ' ,
@@ -656,13 +658,14 @@ private function setupGroupEntityInVendor(MakerTestRunner $runner)
656
658
);
657
659
}
658
660
659
- private function changeToXmlMapping (MakerTestRunner $ runner )
661
+ private function changeToXmlMapping (MakerTestRunner $ runner ): void
660
662
{
661
- $ runner ->replaceInFile (
662
- 'config/packages/doctrine.yaml ' ,
663
- $ this ->useAttributes ($ runner ) ? 'type: attribute ' : 'type: annotation ' ,
664
- 'type: xml '
665
- );
663
+ $ runner ->modifyYamlFile ('config/packages/doctrine.yaml ' , function (array $ data ) {
664
+ $ data ['doctrine ' ]['orm ' ]['mappings ' ]['App ' ]['type ' ] = 'xml ' ;
665
+
666
+ return $ data ;
667
+ });
668
+
666
669
$ runner ->replaceInFile (
667
670
'config/packages/doctrine.yaml ' ,
668
671
"dir: '%kernel.project_dir%/src/Entity' " ,
You can’t perform that action at this time.
0 commit comments