public function create(CurrencyCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $currency = new CurrencyModel();

        $isDefault = CurrencyQuery::create()->count() === 0;

        $currency
            ->setDispatcher($dispatcher)
            ->setLocale($event->getLocale())
            ->setName($event->getCurrencyName())
            ->setSymbol($event->getSymbol())
            ->setFormat($event->getFormat())
            ->setRate($event->getRate())
            ->setCode(strtoupper($event->getCode()))
            ->setByDefault($isDefault)
            ->save()
        ;

        $event->setCurrency($currency);
    }
public function create(CurrencyCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $currency = new CurrencyModel();

        $isDefault = CurrencyQuery::create()->count() === 0;

        $currency
            ->setDispatcher($dispatcher)
            ->setLocale($event->getLocale())
            ->setName($event->getCurrencyName())
            ->setSymbol($event->getSymbol())
            ->setFormat($event->getFormat())
            ->setRate($event->getRate())
            ->setCode(strtoupper($event->getCode()))
            ->setByDefault($isDefault)
            ->save()
        ;

        $event->setCurrency($currency);
    }
public function create ( CurrencyCreateEvent $ event , $ eventName , EventDispatcherInterface $ dispatcher ) { $ currency = new CurrencyModel ( ) ; $ isDefault = CurrencyQuery :: create ( ) -> count ( ) === 0 ; $ currency -> setDispatcher ( $ dispatcher ) -> setLocale ( $ event -> getLocale ( ) ) -> setName ( $ event -> getCurrencyName ( ) ) -> setSymbol ( $ event -> getSymbol ( ) ) -> setFormat ( $ event -> getFormat ( ) ) -> setRate ( $ event -> getRate ( ) ) -> setCode ( strtoupper ( $ event -> getCode ( ) ) ) -> setByDefault ( $ isDefault ) -> save ( ) ; $ event -> setCurrency ( $ currency ) ; }
Create a new currencyuration entry

@param \Thelia\Core\Event\Currency\CurrencyCreateEvent $event
@param $eventName
@param EventDispatcherInterface $dispatcher
Create a new currencyuration entry