create toggleDefault method in lang method and modify in Country model
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Lang\LangToggleDefaultEvent;
|
||||
use Thelia\Core\Event\Lang\LangUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\LangQuery;
|
||||
@@ -52,6 +53,17 @@ class Lang extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleDefault(LangToggleDefaultEvent $event)
|
||||
{
|
||||
if (null !== $lang = LangQuery::create()->findPk($event->getLangId())) {
|
||||
$lang->setDispatcher($this->getDispatcher());
|
||||
|
||||
$lang->toggleDefault();
|
||||
|
||||
$event->setLang($lang);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user