@@ 32-49 (lines=18) @@ | ||
29 | $this->repository = $repository; |
|
30 | } |
|
31 | ||
32 | public function __invoke(RemoveMenuTranslationCommand $command) |
|
33 | { |
|
34 | $menu = $this->repository->menuOfId( |
|
35 | MenuId::generate( |
|
36 | $command->menuId() |
|
37 | ) |
|
38 | ); |
|
39 | if (!$menu instanceof Menu) { |
|
40 | throw new MenuDoesNotExistException(); |
|
41 | } |
|
42 | ||
43 | $menu->removeTranslation( |
|
44 | new Locale( |
|
45 | $command->locale() |
|
46 | ) |
|
47 | ); |
|
48 | $this->repository->persist($menu); |
|
49 | } |
|
50 | } |
|
51 |
@@ 34-48 (lines=15) @@ | ||
31 | $this->menuItemDataTransformer = $menuItemDataTransformer; |
|
32 | } |
|
33 | ||
34 | public function __invoke(MenuOfIdQuery $query) |
|
35 | { |
|
36 | $menu = $this->repository->menuOfId( |
|
37 | MenuId::generate( |
|
38 | $query->menuId() |
|
39 | ) |
|
40 | ); |
|
41 | if (!$menu instanceof Menu) { |
|
42 | throw new MenuDoesNotExistException(); |
|
43 | } |
|
44 | ||
45 | $translation = $menu->{$query->locale()}(); |
|
46 | ||
47 | return $this->tree($translation->tree()); |
|
48 | } |
|
49 | ||
50 | private function tree($items) |
|
51 | { |