public function toggleVisibility(ProductToggleVisibilityEvent $event)
    {
        $product = $event->getProduct();

        $product
            ->setDispatcher($this->eventDispatcher)
            ->setVisible($product->getVisible() ? false : true)
            ->save()
            ;

        $event->setProduct($product);
    }
public function toggleVisibility(ProductToggleVisibilityEvent $event)
    {
        $product = $event->getProduct();

        $product
            ->setDispatcher($this->eventDispatcher)
            ->setVisible($product->getVisible() ? false : true)
            ->save()
            ;

        $event->setProduct($product);
    }
public function toggleVisibility ( ProductToggleVisibilityEvent $ event ) { $ product = $ event -> getProduct ( ) ; $ product -> setDispatcher ( $ this -> eventDispatcher ) -> setVisible ( $ product -> getVisible ( ) ? false : true ) -> save ( ) ; $ event -> setProduct ( $ product ) ; }
Toggle product visibility. No form used here

@param ProductToggleVisibilityEvent $event
Toggle product visibility . No form used here