validate country creation

This commit is contained in:
Manuel Raynaud
2013-10-07 12:46:40 +02:00
parent 0f1dee978c
commit 65d23db854
12 changed files with 70 additions and 14 deletions

View File

@@ -22,11 +22,13 @@
/*************************************************************************************/
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Country\CountryCreateEvent;
use Thelia\Core\Event\Country\CountryDeleteEvent;
use Thelia\Core\Event\Country\CountryUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Country as CountryModel;
/**
@@ -39,6 +41,17 @@ class Country extends BaseAction implements EventSubscriberInterface
public function create(CountryCreateEvent $event)
{
$country = new CountryModel();
$country
->setIsocode($event->getIsocode())
->setIsoalpha2($event->getIsoAlpha2())
->setIsoalpha3($event->getIsoAlpha3())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->save();
$event->setCountry($country);
}