Repository: pimcore/pimcore (language: php)

Issue:
[Bug]: Command pimcore:build:classes requires DB connection for certain data-types
### Improvement description

`pimcore:build:classes` is intendet to be used for CI during build step and therefore should work without a database connection. 
Actually there are some data-types at the moment that require a DB, mostly variants of the select data-type. 

The actual problem is when calling `configureOptions()` e.g. here: 
https://github.com/pimcore/pimcore/blob/3ffaeac8d9f07f877ea4f469015be1774de447b9/models/DataObject/ClassDefinition/Data/Language.php#L73

If in this case, e.g. the system-config is stored in the `settings-store` (like in the demos) it tries to load the available languages from the database. 
But the same also happens with other data-types.





Discussion / hints:

Fix patch:
diff --git a/models/DataObject/ClassDefinition/Data/AbstractQuantityValue.php b/models/DataObject/ClassDefinition/Data/AbstractQuantityValue.php
index d28381e5aea..3b12b1c0276 100644
--- a/models/DataObject/ClassDefinition/Data/AbstractQuantityValue.php
+++ b/models/DataObject/ClassDefinition/Data/AbstractQuantityValue.php
@@ -215,7 +215,9 @@ public static function __set_state(array $data): static
     {
         $obj = parent::__set_state($data);
 
-        $obj->configureOptions();
+        if (Pimcore::inAdmin()) {
+            $obj->configureOptions();
+        }
 
         return $obj;
     }
diff --git a/models/DataObject/ClassDefinition/Data/Language.php b/models/DataObject/ClassDefinition/Data/Language.php
index a9e5b94b755..1b507deaea4 100644
--- a/models/DataObject/ClassDefinition/Data/Language.php
+++ b/models/DataObject/ClassDefinition/Data/Language.php
@@ -16,6 +16,7 @@
 
 namespace Pimcore\Model\DataObject\ClassDefinition\Data;
 
+use Pimcore;
 use Pimcore\Model;
 use Pimcore\Model\DataObject\ClassDefinition\Service;
 use Pimcore\Tool;
@@ -70,7 +71,10 @@ public function setOnlySystemLanguages(bool|int $value): static
     public static function __set_state(array $data): static
     {
         $obj = parent::__set_state($data);
-        $obj->configureOptions();
+
+        if (Pimcore::inAdmin()) {
+            $obj->configureOptions();
+        }
 
         return $obj;
     }
diff --git a/models/DataObject/ClassDefinition/Data/Languagemultiselect.php b/models/DataObject/ClassDefinition/Data/Languagemultiselect.php
index 75eae3a0f56..8af992ed146 100644
--- a/models/DataObject/ClassDefinition/Data/Languagemultiselect.php
+++ b/models/DataObject/ClassDefinition/Data/Languagemultiselect.php
@@ -17,6 +17,7 @@
 namespace Pimcore\Model\DataObject\ClassDefinition\Data;
 
 use Exception;
+use Pimcore;
 use Pimcore\Model;
 use Pimcore\Model\DataObject\ClassDefinition\Service;
 use Pimcore\Tool;
@@ -73,7 +74,10 @@ public function setOnlySystemLanguages(bool|int|null $value): static
     public static function __set_state(array $data): static
     {
         $obj = parent::__set_state($data);
-        $obj->configureOptions();
+
+        if (Pimcore::inAdmin()) {
+            $obj->configureOptions();
+        }
 
         return $obj;
     }
diff --git a/models/DataObject/ClassDefinition/Data/QuantityValueRange.php b/models/DataObject/ClassDefinition/Data/QuantityValueRange.php
index 0907536ff16..44d02520f7d 100644
--- a/models/DataObject/ClassDefinition/Data/QuantityValueRange.php
+++ b/models/DataObject/ClassDefinition/Data/QuantityValueRange.php
@@ -17,6 +17,7 @@
 namespace Pimcore\Model\DataObject\ClassDefinition\Data;
 
 use Exception;
+use Pimcore;
 use Pimcore\Model\DataObject;
 use Pimcore\Model\DataObject\ClassDefinition\Data;
 use Pimcore\Model\Element\ValidationException;
@@ -335,7 +336,10 @@ public function configureOptions(): void
     public static function __set_state(array $data): static
     {
         $obj = parent::__set_state($data);
-        $obj->configureOptions();
+
+        if (Pimcore::inAdmin()) {
+            $obj->configureOptions();
+        }
 
         return $obj;
     }


Test patch: