2424use Symfony \Component \Console \Helper \Dumper ;
2525use Symfony \Component \Console \Input \InputArgument ;
2626use Symfony \Component \Console \Input \InputInterface ;
27+ use Symfony \Component \Console \Input \InputOption ;
2728use Symfony \Component \Console \Output \OutputInterface ;
2829use Symfony \Component \Console \Style \SymfonyStyle ;
2930use Symfony \Component \PropertyAccess \PropertyAccess ;
@@ -56,6 +57,7 @@ public function configure(): void
5657 );
5758 $ this ->addArgument ('resource ' , InputArgument::OPTIONAL , 'Resource to debug ' );
5859 $ this ->addArgument ('operation ' , InputArgument::OPTIONAL , 'Operation to debug ' );
60+ $ this ->addOption ('legacy ' , null , InputOption::VALUE_NONE , 'Show legacy resource metadata. ' );
5961 }
6062
6163 public function execute (InputInterface $ input , OutputInterface $ output ): int
@@ -92,6 +94,12 @@ public function execute(InputInterface $input, OutputInterface $output): int
9294 return Command::SUCCESS ;
9395 }
9496
97+ if ($ input ->getOption ('legacy ' )) {
98+ $ this ->debugLegacyResourceMetadata ($ metadata , $ input , $ io , $ dumper );
99+
100+ return Command::SUCCESS ;
101+ }
102+
95103 $ this ->debugResource ($ metadata , $ input , $ io , $ dumper );
96104
97105 return Command::SUCCESS ;
@@ -115,6 +123,19 @@ private function listResources(SymfonyStyle $io): void
115123
116124 private function debugResource (MetadataInterface $ metadata , InputInterface $ input , SymfonyStyle $ io , Dumper $ dumper ): void
117125 {
126+ $ resourceMetadataCollection = $ this ->getResourceMetadataCollection ($ metadata );
127+
128+ $ this ->debugResourceMetadata ($ resourceMetadataCollection , $ io , $ dumper );
129+
130+ $ this ->debugResourceCollectionOperation ($ metadata , $ input , $ io , $ dumper );
131+ }
132+
133+ private function debugLegacyResourceMetadata (
134+ MetadataInterface $ metadata ,
135+ InputInterface $ input ,
136+ SymfonyStyle $ io ,
137+ Dumper $ dumper ,
138+ ): void {
118139 $ io ->section ('Configuration ' );
119140
120141 $ values = $ this ->configurationToArray ($ metadata );
@@ -126,12 +147,6 @@ private function debugResource(MetadataInterface $metadata, InputInterface $inpu
126147 }
127148
128149 $ io ->table (['Option ' , 'Value ' ], $ rows );
129-
130- $ resourceMetadataCollection = $ this ->getResourceMetadataCollection ($ metadata );
131-
132- $ this ->debugNewResourceMetadata ($ resourceMetadataCollection , $ io , $ dumper );
133-
134- $ this ->debugResourceCollectionOperation ($ metadata , $ input , $ io , $ dumper );
135150 }
136151
137152 private function getResourceMetadataCollection (MetadataInterface $ resourceConfiguration ): ResourceMetadataCollection
@@ -154,12 +169,12 @@ private function debugOperation(Operation $operation, SymfonyStyle $io, Dumper $
154169 $ io ->table (['Option ' , 'Value ' ], $ rows );
155170 }
156171
157- private function debugNewResourceMetadata (ResourceMetadataCollection $ resourceMetadataCollection , SymfonyStyle $ io , Dumper $ dumper ): void
172+ private function debugResourceMetadata (ResourceMetadataCollection $ resourceMetadataCollection , SymfonyStyle $ io , Dumper $ dumper ): void
158173 {
159- $ io ->section ('New Resource Metadata ' );
174+ $ io ->section ('Resource Metadata ' );
160175
161176 if (0 === $ resourceMetadataCollection ->count ()) {
162- $ io ->info ('This resource has no new metadata. ' );
177+ $ io ->info ('This resource has no metadata. ' );
163178
164179 return ;
165180 }
@@ -179,7 +194,7 @@ private function debugNewResourceMetadata(ResourceMetadataCollection $resourceMe
179194
180195 private function debugResourceCollectionOperation (MetadataInterface $ metadata , InputInterface $ input , SymfonyStyle $ io , Dumper $ dumper ): void
181196 {
182- $ io ->section ('New operations ' );
197+ $ io ->section ('Operations ' );
183198
184199 $ resourceMetadataCollection = $ this ->resourceMetadataCollectionFactory ->create ($ metadata ->getClass ('model ' ));
185200
0 commit comments