Allow to show all parts of all categories in a single KiCad category by setting EDA_KICAD_CATEGORY_DEPTH to -1

This commit is contained in:
Jan Böhmer 2023-12-03 15:03:00 +01:00
parent 459ae163da
commit 6926f6b233
3 changed files with 40 additions and 14 deletions

View file

@ -62,9 +62,13 @@ class KiCadApiController extends AbstractController
}
#[Route('/parts/category/{category}.json', name: 'kicad_api_category')]
public function categoryParts(Category $category): Response
public function categoryParts(?Category $category): Response
{
$this->denyAccessUnlessGranted('read', $category);
if ($category) {
$this->denyAccessUnlessGranted('read', $category);
} else {
$this->denyAccessUnlessGranted('@categories.read');
}
$this->denyAccessUnlessGranted('@parts.read');
return $this->json($this->kiCADHelper->getCategoryParts($category));