diff --git a/.env b/.env
index ae2d1e07..28e53b97 100644
--- a/.env
+++ b/.env
@@ -152,8 +152,8 @@ PROVIDER_LCSC_CURRENCY=EUR
# This value determines the depth of the category tree, that is visible inside KiCad
# 0 means that only the top level categories are visible. Set to a value > 0 to show more levels.
-# Set to -1, to show all parts of Part-DB inside a single category in KiCad
-EDA_KICAD_CATEGORY_DEPTH=0
+# Set to -1, to show all parts of Part-DB inside a sigle cnategory in KiCad
+#EDA_KICAD_CATEGORY_DEPTH=0
###################################################################################
# SAML Single sign on-settings
diff --git a/config/parameters.yaml b/config/parameters.yaml
index a266e1a4..95e78773 100644
--- a/config/parameters.yaml
+++ b/config/parameters.yaml
@@ -122,6 +122,4 @@ parameters:
env(SAML_ROLE_MAPPING): '{}'
- env(EDA_KICAD_CATEGORY_DEPTH): 0
-
env(DATABASE_EMULATE_NATURAL_SORT): 0
diff --git a/config/services.yaml b/config/services.yaml
index 5deeef34..88df6b71 100644
--- a/config/services.yaml
+++ b/config/services.yaml
@@ -234,13 +234,6 @@ services:
arguments:
$default_uri: '%partdb.default_uri%'
- ####################################################################################################################
- # EDA system
- ####################################################################################################################
- App\Services\EDA\KiCadHelper:
- arguments:
- $category_depth: '%env(int:EDA_KICAD_CATEGORY_DEPTH)%'
-
####################################################################################################################
# Symfony overrides
####################################################################################################################
diff --git a/src/Services/EDA/KiCadHelper.php b/src/Services/EDA/KiCadHelper.php
index 13de01e8..61097e0a 100644
--- a/src/Services/EDA/KiCadHelper.php
+++ b/src/Services/EDA/KiCadHelper.php
@@ -28,6 +28,7 @@ use App\Entity\Parts\Footprint;
use App\Entity\Parts\Part;
use App\Services\Cache\ElementCacheTagGenerator;
use App\Services\Trees\NodesListBuilder;
+use App\Settings\MiscSettings\KiCadEDASettings;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -38,6 +39,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class KiCadHelper
{
+ /** @var int The maximum level of the shown categories. 0 Means only the top level categories are shown. -1 means only a single one containing */
+ private readonly int $category_depth;
+
public function __construct(
private readonly NodesListBuilder $nodesListBuilder,
private readonly TagAwareCacheInterface $kicadCache,
@@ -45,9 +49,9 @@ class KiCadHelper
private readonly ElementCacheTagGenerator $tagGenerator,
private readonly UrlGeneratorInterface $urlGenerator,
private readonly TranslatorInterface $translator,
- /** The maximum level of the shown categories. 0 Means only the top level categories are shown. -1 means only a single one containing */
- private readonly int $category_depth,
+ KiCadEDASettings $kiCadEDASettings,
) {
+ $this->category_depth = $kiCadEDASettings->categoryDepth;
}
/**
diff --git a/src/Settings/AppSettings.php b/src/Settings/AppSettings.php
index 073521b5..1522ad11 100644
--- a/src/Settings/AppSettings.php
+++ b/src/Settings/AppSettings.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings;
use App\Settings\InfoProviderSystem\InfoProviderSettings;
+use App\Settings\MiscSettings\MiscSettings;
use App\Settings\SystemSettings\AttachmentsSettings;
use Jbtronics\SettingsBundle\Settings\EmbeddedSettings;
use Jbtronics\SettingsBundle\Settings\Settings;
@@ -38,7 +39,9 @@ class AppSettings
#[EmbeddedSettings()]
public ?SystemSettings $system = null;
-
#[EmbeddedSettings()]
public ?InfoProviderSettings $infoProviders = null;
+
+ #[EmbeddedSettings()]
+ public ?MiscSettings $miscSettings = null;
}
\ No newline at end of file
diff --git a/src/Settings/MiscSettings/KiCadEDASettings.php b/src/Settings/MiscSettings/KiCadEDASettings.php
new file mode 100644
index 00000000..d8f1026d
--- /dev/null
+++ b/src/Settings/MiscSettings/KiCadEDASettings.php
@@ -0,0 +1,46 @@
+.
+ */
+
+declare(strict_types=1);
+
+
+namespace App\Settings\MiscSettings;
+
+use App\Settings\SettingsIcon;
+use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
+use Jbtronics\SettingsBundle\Settings\Settings;
+use Jbtronics\SettingsBundle\Settings\SettingsParameter;
+use Jbtronics\SettingsBundle\Settings\SettingsTrait;
+use Symfony\Component\Translation\TranslatableMessage as TM;
+use Symfony\Component\Validator\Constraints as Assert;
+
+#[Settings(label: new TM("settings.misc.kicad_eda"))]
+#[SettingsIcon("fa-bolt-lightning")]
+class KiCadEDASettings
+{
+ use SettingsTrait;
+
+
+ #[SettingsParameter(label: new TM("settings.misc.kicad_eda.category_depth"),
+ description: new TM("settings.misc.kicad_eda.category_depth.help"),
+ envVar: "int:EDA_KICAD_CATEGORY_DEPTH", envVarMode: EnvVarMode::OVERWRITE)]
+ #[Assert\Range(min: -1)]
+ public int $categoryDepth = 0;
+}
\ No newline at end of file
diff --git a/src/Settings/MiscSettings/MiscSettings.php b/src/Settings/MiscSettings/MiscSettings.php
new file mode 100644
index 00000000..a2ad0fd4
--- /dev/null
+++ b/src/Settings/MiscSettings/MiscSettings.php
@@ -0,0 +1,34 @@
+.
+ */
+
+declare(strict_types=1);
+
+
+namespace App\Settings\MiscSettings;
+
+use Jbtronics\SettingsBundle\Settings\EmbeddedSettings;
+use Jbtronics\SettingsBundle\Settings\Settings;
+
+#[Settings]
+class MiscSettings
+{
+ #[EmbeddedSettings]
+ public ?KiCadEDASettings $kicadEDA = null;
+}
\ No newline at end of file
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf
index e8abc2b8..8bbe1eb3 100644
--- a/translations/messages.en.xlf
+++ b/translations/messages.en.xlf
@@ -12594,5 +12594,23 @@ Please note, that you can not impersonate a disabled user. If you try you will g
Server settings
+
+
+ settings.misc.kicad_eda
+ KiCAD integration
+
+
+
+
+ settings.misc.kicad_eda.category_depth
+ Category depth
+
+
+
+
+ settings.misc.kicad_eda.category_depth.help
+ 0 to show more levels. Set to -1, to show all parts of Part-DB inside a sigle cnategory in KiCad.]]>
+
+