Quellcode durchsuchen

Fix multiple entity join filtering.

Romain Geissler vor 13 Jahren
Ursprung
Commit
859bc9a4f2
2 geänderte Dateien mit 38 neuen und 0 gelöschten Zeilen
  1. 28 0
      Filter/Filter.php
  2. 10 0
      Filter/FilterInterface.php

+ 28 - 0
Filter/Filter.php

@@ -135,6 +135,34 @@ abstract class Filter implements FilterInterface
         return $this->getOption('parent_association_mappings', array());
     }
 
+    /**
+     * @return array field mapping
+     */
+    public function getFieldMapping()
+    {
+        $fieldMapping = $this->getOption('field_mapping');
+
+        if (!$fieldMapping) {
+            throw new \RunTimeException(sprintf('The option `field_mapping` must be set for field : `%s`', $this->getName()));
+        }
+
+        return $fieldMapping;
+    }
+
+    /**
+     * @return array association mapping
+     */
+    public function getAssociationMapping()
+    {
+        $associationMapping = $this->getOption('association_mapping');
+
+        if (!$associationMapping) {
+            throw new \RunTimeException(sprintf('The option `association_mapping` must be set for field : `%s`', $this->getName()));
+        }
+
+        return $associationMapping;
+    }
+
     /**
      * @param array $options
      * @return void

+ 10 - 0
Filter/FilterInterface.php

@@ -101,6 +101,16 @@ interface FilterInterface
      */
     function getParentAssociationMappings();
 
+    /**
+     * @return array field mapping
+     */
+    function getFieldMapping();
+
+    /**
+     * @return array association mapping
+     */
+    function getAssociationMapping();
+
     /**
      * @abstract
      * @return array