@@ -19,7 +19,7 @@ class MappingImportCommand extends Command
19
19
{mapping-type=xml : The mapping type to export the imported mapping information to}
20
20
{dest-path? : Location the mapping files should be imported to}
21
21
{--em=default : Info for a specific entity manager }
22
- {--filter= : A string pattern used to match entities that should be mapped}
22
+ {--filter : A string pattern used to match entities that should be mapped}
23
23
{--force= : Force to overwrite existing mapping files}
24
24
{--namespace= : Namespace to use} ' ;
25
25
@@ -42,7 +42,18 @@ public function fire(ManagerRegistry $registry)
42
42
43
43
$ destPath = base_path ($ this ->argument ('dest-path ' ) ? $ this ->argument ('dest-path ' ) : 'app/Mappings ' );
44
44
45
- $ type = $ this ->argument ('mapping-type ' );
45
+ $ simplified = false ;
46
+ $ type = $ this ->argument ('mapping-type ' );
47
+
48
+ if (starts_with ($ type , 'simplified ' )) {
49
+ $ simplified = true ;
50
+
51
+ if (str_contains ($ type , 'xml ' )) {
52
+ $ type = 'xml ' ;
53
+ } elseif (str_contains ($ type , 'yaml ' )) {
54
+ $ type = 'yaml ' ;
55
+ }
56
+ }
46
57
47
58
$ cme = new ClassMetadataExporter ();
48
59
$ exporter = $ cme ->getExporter ($ type );
@@ -77,6 +88,9 @@ public function fire(ManagerRegistry $registry)
77
88
$ className = $ class ->name ;
78
89
if ('annotation ' === $ type ) {
79
90
$ path = $ destPath . '/ ' . str_replace ('\\' , '. ' , $ className ) . '.php ' ;
91
+ } elseif ($ simplified ) {
92
+ $ element = explode ('\\' , $ className );
93
+ $ path = $ destPath . '/ ' . end ($ element ) . '.orm. ' . $ type ;
80
94
} else {
81
95
$ path = $ destPath . '/ ' . str_replace ('\\' , '. ' , $ className ) . '.dcm. ' . $ type ;
82
96
}
0 commit comments