Repository: pimcore/pimcore (language: php)

Issue:
[Bug, EC]: Error in DB query when using objectBrick in gridview
### Pimcore version

11.4.x

### Steps to reproduce

1. Create 2 objectBricks and on each one create a manyToOne field with same name 
2. Open grid view and add the 2 fields on different bricks
3. Populate the relation fields with some test value and then try to filter with "filter by relation”

### Actual Behavior

 An error occurs in DB query while using 2 relation fields (manyToOne) with same name in different objectBricks. For example, if you have 2 fields named "Color” in 2 different brick and you try to filter in a grid view, it shows the error attached.

![Image](https://github.com/user-attachments/assets/dfea2cb8-89e4-4fa2-aba6-6023b4d5da1d)
![Image](https://github.com/user-attachments/assets/1bda0ab2-88ac-4c9c-b50e-633df246169c)


### Expected Behavior

It works :-)


Discussion / hints:

Fix patch:
diff --git a/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php b/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php
index d7d70a873f0..bf5e42463c4 100644
--- a/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php
+++ b/models/DataObject/ClassDefinition/Data/ManyToOneRelation.php
@@ -552,12 +552,14 @@ public function getPhpdocReturnType(): ?string
     public function getFilterConditionExt(mixed $value, string $operator, array $params = []): string
     {
         $name = $params['name'] . '__id';
+        $prefix = $params['brickPrefix'] ?? '';
         if (preg_match('/^(asset|object|document)\|(\d+)/', $value, $matches)) {
             $typeField = $params['name'] . '__type';
             $typeCondition = '`' . $typeField . '` = ' . "'" . $matches[1] . "'";
             $value = $matches[2];
 
-            return '(' . $typeCondition . ' AND ' . $this->getRelationFilterCondition($value, $operator, $name) . ')';
+            return '(' . $prefix . $typeCondition . ' AND ' . $prefix
+                . $this->getRelationFilterCondition($value, $operator, $name) . ')';
         }
 
         return $this->getRelationFilterCondition($value, $operator, $name);


Test patch: