Normalize resource name

This commit is contained in:
2024-04-02 11:34:33 +02:00
parent 430583f6ba
commit b45ced3f5d
+6 -1
View File
@@ -49,7 +49,7 @@ class VersionStateProvider implements ProviderInterface
private function getVersions(string $resource, int $resourceId)
{
$entity = $this->entityManager->find(sprintf("App\\Entity\\%s", $resource), $resourceId);
$entity = $this->entityManager->find($this->resourceToEntity($resource), $resourceId);
$logs = $this->versionRepository->getLogEntries($entity);
$versions = [];
@@ -59,4 +59,9 @@ class VersionStateProvider implements ProviderInterface
return $versions;
}
private function resourceToEntity(string $resource): string
{
return sprintf("App\\Entity\\%s", ucfirst(strtolower($resource)));
}
}