Skip to content

Commit

Permalink
Merge pull request dustin10#1307 from endelwar/improve-debug-class
Browse files Browse the repository at this point in the history
Improve output of vich:mapping:debug-class
  • Loading branch information
garak authored Jul 25, 2022
2 parents ff3c5c6 + ac28471 commit e2fe2c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/Command/MappingDebugClassCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$output->writeln(\sprintf('Introspecting class <info>%s</info>:', $fqcn));
foreach ($uploadableFields as $data) {
$output->writeln(\sprintf('Found field "<comment>%s</comment>", storing file name in <comment>"%s</comment>" and using mapping "<comment>%s</comment>"', $data['propertyName'], $data['fileNameProperty'], $data['mapping']));
$output->writeln(\sprintf('Found field "<comment>%s</comment>":', $data['propertyName']));
$output->writeln(\sprintf("\t<comment>mapping</comment>: %s", $data['mapping']));
$output->writeln(\sprintf("\t<comment>file name</comment>: %s", $data['fileNameProperty'] ?? '<error>not set</error>'));
$output->writeln(\sprintf("\t<comment>original name</comment>: %s", $data['originalName'] ?? '<error>not set</error>'));
$output->writeln(\sprintf("\t<comment>size</comment>: %s", $data['size'] ?? '<error>not set</error>'));
$output->writeln(\sprintf("\t<comment>mime type</comment>: %s", $data['mimeType'] ?? '<error>not set</error>'));
$output->writeln(\sprintf("\t<comment>dimensions</comment>: %s", $data['dimensions'] ?? '<error>not set</error>'));
}

return 0;
Expand Down
12 changes: 9 additions & 3 deletions templates/Collector/mapping_collector.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@

{% block panel %}
<h2>VichUploaderBundle Mappings</h2>
<p class="help"><strong>Note</strong>: Only classes configured using XML or YAML are displayed.</p>
<table>
<thead>
<tr>
<th scope="col">Field</th>
<th scope="col">Mapping</th>
<th scope="col">Filename property</th>
<th scope="col">Size property</th>
<th scope="col">Mime Type property</th>
<th scope="col">Original Name property</th>
<th scope="col">Dimensions property</th>
</tr>
</thead>
<tbody>
Expand All @@ -46,10 +49,13 @@
<tr>
<td>{{ mdata.propertyName }}</td>
<td>{{ mdata.mapping }}</td>
<td>{{ mdata.fileNameProperty }}</td>
<td>{{ mdata.fileNameProperty|default('<span class="text-danger">Not Set</span>')|raw }}</td>
<td>{{ mdata.size|default('<span class="text-danger">Not Set</span>')|raw }}</td>
<td>{{ mdata.mimeType|default('<span class="text-danger">Not Set</span>')|raw }}</td>
<td>{{ mdata.originalName|default('<span class="text-danger">Not Set</span>')|raw }}</td>
<td>{{ mdata.dimensions|default('<span class="text-danger">Not Set</span>')|raw }}</td>
</tr>
{% endfor %}
{# TODO size, mimeType, originalName,dimesions? #}
{% endfor %}
</tbody>
</table>
Expand Down

0 comments on commit e2fe2c2

Please sign in to comment.