Skip to content

Commit

Permalink
Fix Flash helper
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Jun 20, 2023
1 parent 9aa7fcc commit b94edac
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/Component/Symfony/Session/Flash/FlashHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,6 @@ private function addFlash(string $message, string $type, Context $context): void
$flashBag->add($type, $message);
}

private function buildMessage(Operation $operation, string $type): string
{
$resource = $operation->getResource();
Assert::notNull($resource);

$specifyKey = sprintf('%s.%s.%s', $resource->getApplicationName() ?? '', $resource->getName() ?? '', $operation->getShortName() ?? '');
$defaultKey = sprintf('sylius.resource.%s', $operation->getShortName() ?? '');

$parameters = $this->getTranslationParameters($operation);

if (!$this->translator instanceof TranslatorBagInterface) {
return $this->translator->trans($defaultKey, $parameters, 'flashes');
}

if ($this->translator->getCatalogue()->has($specifyKey, 'flashes')) {
return $this->translator->trans($specifyKey, $parameters, 'flashes');
}

return $this->translator->trans($defaultKey, $parameters, 'flashes');
}

private function getTranslationParameters(Operation $operation): array
{
$resource = $operation->getResource();
Expand Down

0 comments on commit b94edac

Please sign in to comment.