Example #1
0
 public function update(CountryUpdateEvent $event)
 {
     if (null !== ($country = CountryQuery::create()->findPk($event->getCountryId()))) {
         $country->setIsocode($event->getIsocode())->setIsoalpha2($event->getIsoAlpha2())->setIsoalpha3($event->getIsoAlpha3())->setLocale($event->getLocale())->setTitle($event->getTitle())->setChapo($event->getChapo())->setDescription($event->getDescription())->save();
         $event->setCountry($country);
     }
 }
Example #2
0
 /**
  * @param CountryModel $country
  * @depends testCreate
  */
 public function testUpdate(CountryModel $country)
 {
     $event = new CountryUpdateEvent($country->getId());
     $event->setIsocode('002')->setIsoAlpha2('BB')->setIsoAlpha3('BBB')->setLocale('en_US')->setTitle('Test')->setDispatcher($this->dispatcher);
     $action = new Country();
     $action->update($event);
     $updatedCountry = $event->getCountry();
     $this->assertInstanceOf('Thelia\\Model\\Country', $updatedCountry);
     $this->assertEquals('002', $updatedCountry->getIsocode());
     $this->assertEquals('BB', $updatedCountry->getIsoalpha2());
     $this->assertEquals('BBB', $updatedCountry->getIsoalpha3());
     $this->assertEquals('en_US', $updatedCountry->getLocale());
     $this->assertEquals('Test', $updatedCountry->getTitle());
     return $updatedCountry;
 }
Example #3
0
 public function update(CountryUpdateEvent $event)
 {
     if (null !== ($country = CountryQuery::create()->findPk($event->getCountryId()))) {
         $country->setVisible($event->isVisible())->setIsocode($event->getIsocode())->setIsoalpha2($event->getIsoAlpha2())->setIsoalpha3($event->getIsoAlpha3())->setHasStates($event->isHasStates())->setNeedZipCode($event->isNeedZipCode())->setZipCodeFormat($event->getZipCodeFormat())->setLocale($event->getLocale())->setTitle($event->getTitle())->setChapo($event->getChapo())->setDescription($event->getDescription())->save();
         $event->setCountry($country);
     }
 }