File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed 
src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 2121use  Pimcore \Bundle \GenericDataIndexBundle \Enum \SearchIndex \OpenSearch \AttributeType ;
2222use  Pimcore \Bundle \StaticResolverBundle \Models \DataObject \FieldCollection \DefinitionResolverInterface ;
2323use  Pimcore \Model \DataObject \ClassDefinition \Data \Fieldcollections ;
24+ use  Pimcore \Model \DataObject \Fieldcollection ;
2425use  Symfony \Contracts \Service \Attribute \Required ;
2526
2627/** 
@@ -68,6 +69,38 @@ public function getIndexMapping(): array
6869            ];
6970    }
7071
72+     public  function  normalize (mixed  $ valuearray 
73+     {
74+         if  (!$ valueinstanceof  Fieldcollection) {
75+             return  null ;
76+         }
77+ 
78+         $ resultItems
79+         $ items$ valuegetItems ();
80+ 
81+         foreach  ($ itemsas  $ item
82+             $ type$ itemgetType ();
83+             $ fieldCollectionDefinition$ this fieldCollectionDefinition ->getByKey ($ itemgetType ());
84+             if  (!$ fieldCollectionDefinition
85+                 continue ;
86+             }
87+             $ resultItem'type '  => $ type
88+ 
89+             foreach  ($ fieldCollectionDefinitiongetFieldDefinitions () as  $ fieldDefinition
90+                 $ getter'get '  . ucfirst ($ fieldDefinitiongetName ());
91+                 $ value$ item$ getter
92+                 $ resultItem$ fieldDefinitiongetName ()] = $ this fieldDefinitionService ->normalizeValue (
93+                     $ fieldDefinition
94+                     $ value
95+                 );
96+             }
97+ 
98+             $ resultItems$ resultItem
99+         }
100+ 
101+         return  $ resultItems
102+     }
103+ 
71104    #[Required]
72105    public  function  setFieldCollectionDefinition (DefinitionResolverInterface $ definitionResolvervoid 
73106    {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments