public function deleteTemplateFeature(TemplateDeleteFeatureEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        // Detete the removed feature in all products which are using this template
        $products = ProductQuery::create()
            ->filterByTemplateId($event->getTemplate()->getId())
            ->find()
        ;
        
        foreach ($products as $product) {
            $dispatcher->dispatch(
                TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE,
                new FeatureProductDeleteEvent($product->getId(), $event->getFeatureId())
            );
        }
    }
public function deleteTemplateFeature(TemplateDeleteFeatureEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        // Detete the removed feature in all products which are using this template
        $products = ProductQuery::create()
            ->filterByTemplateId($event->getTemplate()->getId())
            ->find()
        ;
        
        foreach ($products as $product) {
            $dispatcher->dispatch(
                TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE,
                new FeatureProductDeleteEvent($product->getId(), $event->getFeatureId())
            );
        }
    }
public function deleteTemplateFeature ( TemplateDeleteFeatureEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { // Detete the removed feature in all products which are using this template $ products = ProductQuery :: create ( ) -> filterByTemplateId ( $ event -> getTemplate ( ) -> getId ( ) ) -> find ( ) ; foreach ( $ products as $ product ) { $ dispatcher -> dispatch ( TheliaEvents :: PRODUCT_FEATURE_DELETE_VALUE , new FeatureProductDeleteEvent ( $ product -> getId ( ) , $ event -> getFeatureId ( ) ) ) ; } }
When a feature is removed from a template, the products which are using this feature should be updated.

@param TemplateDeleteFeatureEvent $event
@param string $eventName
@param EventDispatcherInterface $dispatcher
When a feature is removed from a template the products which are using this feature should be updated .