| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Dynamic\Products\Extension; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Dynamic\Products\Page\Product; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Dynamic\Products\Page\ProductCategory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use SilverStripe\Forms\DropdownField; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use SilverStripe\ORM\ArrayList; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use SilverStripe\ORM\DataExtension; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | class ProductFileCollectionDataExtension extends DataExtension | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |      * @param $object | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |     public function updateCollectionObject(&$object) | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |         if ($class = $this->owner->data()->ManagedClass) { | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |             $object = singleton((string) $class); | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |      * @param $form | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public function updateCollectionForm(&$form) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $fields = $form->Fields(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         $fields->insertAfter( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |             DropdownField::create('CategoryID', 'Category', ProductCategory::get()->map()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |                 ->setEmptyString('All categories'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |             'Title' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $fields->insertAfter( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             DropdownField::create('Products__ID', 'Product', Product::get()->map()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |                 ->setEmptyString('All products'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |             'CategoryID' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $fields->removeByName([ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  |             'Title', | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |         ]); | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |      * @param $collection | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |      * @param $searchCriteria | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     public function updateCollectionItems(&$collection, &$searchCriteria) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $class = $this->owner->data()->ManagedClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         if (isset($searchCriteria['CategoryID']) && $searchCriteria['CategoryID'] != '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |             $category = ProductCategory::get()->byID($searchCriteria['CategoryID']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             $products = $category->Products(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             $docs = new ArrayList(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |             foreach ($products as $product) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |                 $records = $class::get()->filter(['Products.ID' => $product->ID]); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |                 foreach ($records as $record) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |                     $docs->push($record); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 67 |  |  |             $collection = $docs; | 
            
                                                                        
                                                                
            
                                    
            
            
                | 68 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 70 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 71 |  |  |  | 
            
                        
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.