Esempio n. 1
0
 public function toggleVisibility(ContentToggleVisibilityEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     $content = $event->getContent();
     $content->setDispatcher($dispatcher)->setVisible(!$content->getVisible())->save();
     $event->setContent($content);
 }
Esempio n. 2
0
 public function testContentToggleVisibility()
 {
     $content = $this->getRandomContent();
     $visibility = $content->getVisible();
     $event = new ContentToggleVisibilityEvent($content);
     $event->setDispatcher($this->dispatcher);
     $contentAction = new Content($this->getContainer());
     $contentAction->toggleVisibility($event);
     $updatedContent = $event->getContent();
     $this->assertInstanceOf('Thelia\\Model\\Content', $updatedContent);
     $this->assertEquals(!$visibility, $updatedContent->getVisible());
 }
Esempio n. 3
0
 public function toggleVisibility(ContentToggleVisibilityEvent $event)
 {
     $content = $event->getContent();
     $content->setDispatcher($event->getDispatcher())->setVisible(!$content->getVisible())->save();
     $event->setContent($content);
 }