Ejemplo n.º 1
0
 /**
  * Delete a currencyuration entry
  *
  * @param \Thelia\Core\Event\Currency\CurrencyDeleteEvent $event
  */
 public function delete(CurrencyDeleteEvent $event)
 {
     if (null !== ($currency = CurrencyQuery::create()->findPk($event->getCurrencyId()))) {
         $currency->setDispatcher($event->getDispatcher())->delete();
         $event->setCurrency($currency);
     }
 }
Ejemplo n.º 2
0
 /**
  * Delete a currencyuration entry
  *
  * @param \Thelia\Core\Event\Currency\CurrencyDeleteEvent $event
  */
 public function delete(CurrencyDeleteEvent $event)
 {
     if (null !== ($currency = CurrencyQuery::create()->findPk($event->getCurrencyId()))) {
         if ($currency->getByDefault()) {
             throw new \RuntimeException(Translator::getInstance()->trans('It is not allowed to delete the default currency'));
         }
         $currency->setDispatcher($event->getDispatcher())->delete();
         $event->setCurrency($currency);
     }
 }