コード例 #1
0
ファイル: Brand.php プロジェクト: vigourouxjulien/thelia
 /**
  * Toggle Brand visibility
  *
  * @param BrandToggleVisibilityEvent $event
  * @param string $eventName
  * @param EventDispatcherInterface $dispatcher
  * @throws \Exception
  * @throws \Propel\Runtime\Exception\PropelException
  */
 public function toggleVisibility(BrandToggleVisibilityEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     $brand = $event->getBrand();
     $brand->setDispatcher($dispatcher)->setVisible(!$brand->getVisible())->save();
     $event->setBrand($brand);
 }
コード例 #2
0
ファイル: BrandTest.php プロジェクト: alex63530/thelia
 public function testBrandToggleVisibility()
 {
     $brand = $this->getRandomBrand();
     $visibility = $brand->getVisible();
     $event = new BrandToggleVisibilityEvent($brand);
     $event->setDispatcher($this->dispatcher);
     $brandAction = new Brand($this->getContainer());
     $brandAction->toggleVisibility($event);
     $updatedBrand = $event->getBrand();
     $this->assertInstanceOf('Thelia\\Model\\Brand', $updatedBrand);
     $this->assertEquals(!$visibility, $updatedBrand->getVisible());
 }
コード例 #3
0
ファイル: Brand.php プロジェクト: margery/thelia
 /**
  * Toggle Brand visibility
  *
  * @param BrandToggleVisibilityEvent $event
  */
 public function toggleVisibility(BrandToggleVisibilityEvent $event)
 {
     $brand = $event->getBrand();
     $brand->setDispatcher($event->getDispatcher())->setVisible(!$brand->getVisible())->save();
     $event->setBrand($brand);
 }