2222
2323namespace App \Controller ;
2424
25+ use Symfony \Bridge \Doctrine \Attribute \MapEntity ;
2526use Symfony \Component \HttpFoundation \Response ;
2627use App \Entity \ProjectSystem \Project ;
2728use App \Entity \Parts \Category ;
@@ -55,7 +56,7 @@ public function tools(ToolsTreeBuilder $builder): JsonResponse
5556
5657 #[Route(path: '/category/{id} ' , name: 'tree_category ' )]
5758 #[Route(path: '/categories ' , name: 'tree_category_root ' )]
58- public function categoryTree (?Category $ category = null ): JsonResponse
59+ public function categoryTree (#[MapEntity(id: ' id ' )] ?Category $ category = null ): JsonResponse
5960 {
6061 if ($ this ->isGranted ('@parts.read ' ) && $ this ->isGranted ('@categories.read ' )) {
6162 $ tree = $ this ->treeGenerator ->getTreeView (Category::class, $ category , 'list_parts_root ' );
@@ -68,7 +69,7 @@ public function categoryTree(?Category $category = null): JsonResponse
6869
6970 #[Route(path: '/footprint/{id} ' , name: 'tree_footprint ' )]
7071 #[Route(path: '/footprints ' , name: 'tree_footprint_root ' )]
71- public function footprintTree (?Footprint $ footprint = null ): JsonResponse
72+ public function footprintTree (#[MapEntity(id: ' id ' )] ?Footprint $ footprint = null ): JsonResponse
7273 {
7374 if ($ this ->isGranted ('@parts.read ' ) && $ this ->isGranted ('@footprints.read ' )) {
7475 $ tree = $ this ->treeGenerator ->getTreeView (Footprint::class, $ footprint , 'list_parts_root ' );
@@ -80,7 +81,7 @@ public function footprintTree(?Footprint $footprint = null): JsonResponse
8081
8182 #[Route(path: '/location/{id} ' , name: 'tree_location ' )]
8283 #[Route(path: '/locations ' , name: 'tree_location_root ' )]
83- public function locationTree (?StorageLocation $ location = null ): JsonResponse
84+ public function locationTree (#[MapEntity(id: ' id ' )] ?StorageLocation $ location = null ): JsonResponse
8485 {
8586 if ($ this ->isGranted ('@parts.read ' ) && $ this ->isGranted ('@storelocations.read ' )) {
8687 $ tree = $ this ->treeGenerator ->getTreeView (StorageLocation::class, $ location , 'list_parts_root ' );
@@ -93,7 +94,7 @@ public function locationTree(?StorageLocation $location = null): JsonResponse
9394
9495 #[Route(path: '/manufacturer/{id} ' , name: 'tree_manufacturer ' )]
9596 #[Route(path: '/manufacturers ' , name: 'tree_manufacturer_root ' )]
96- public function manufacturerTree (?Manufacturer $ manufacturer = null ): JsonResponse
97+ public function manufacturerTree (#[MapEntity(id: ' id ' )] ?Manufacturer $ manufacturer = null ): JsonResponse
9798 {
9899 if ($ this ->isGranted ('@parts.read ' ) && $ this ->isGranted ('@manufacturers.read ' )) {
99100 $ tree = $ this ->treeGenerator ->getTreeView (Manufacturer::class, $ manufacturer , 'list_parts_root ' );
@@ -106,7 +107,7 @@ public function manufacturerTree(?Manufacturer $manufacturer = null): JsonRespon
106107
107108 #[Route(path: '/supplier/{id} ' , name: 'tree_supplier ' )]
108109 #[Route(path: '/suppliers ' , name: 'tree_supplier_root ' )]
109- public function supplierTree (?Supplier $ supplier = null ): JsonResponse
110+ public function supplierTree (#[MapEntity(id: ' id ' )] ?Supplier $ supplier = null ): JsonResponse
110111 {
111112 if ($ this ->isGranted ('@parts.read ' ) && $ this ->isGranted ('@suppliers.read ' )) {
112113 $ tree = $ this ->treeGenerator ->getTreeView (Supplier::class, $ supplier , 'list_parts_root ' );
@@ -119,7 +120,7 @@ public function supplierTree(?Supplier $supplier = null): JsonResponse
119120
120121 #[Route(path: '/device/{id} ' , name: 'tree_device ' )]
121122 #[Route(path: '/devices ' , name: 'tree_device_root ' )]
122- public function deviceTree (?Project $ device = null ): JsonResponse
123+ public function deviceTree (#[MapEntity(id: ' id ' )] ?Project $ device = null ): JsonResponse
123124 {
124125 if ($ this ->isGranted ('@projects.read ' )) {
125126 $ tree = $ this ->treeGenerator ->getTreeView (Project::class, $ device , 'devices ' );
0 commit comments