Beispiel #1
0
 /**
  * @param TaxRuleEvent $event
  */
 public function setDefault(TaxRuleEvent $event)
 {
     if (null !== ($taxRule = TaxRuleQuery::create()->findPk($event->getId()))) {
         TaxRuleQuery::create()->update(array("IsDefault" => 0));
         $taxRule->setIsDefault(1)->save();
         $event->setTaxRule($taxRule);
     }
 }
Beispiel #2
0
 protected function hydrateEvent(array &$data)
 {
     $event = new TaxRuleEvent();
     if (isset($data["country"])) {
         $event->setCountryList($data["country"]);
     }
     if (isset($data["tax"])) {
         $event->setTaxList($data["tax"]);
     }
     if (isset($data["id"])) {
         $event->setId($data["id"]);
         $event->setTaxRule(TaxRuleQuery::create()->findPk($data["id"]));
     }
     if (isset($data["i18n"]) && null !== ($row = array_shift($data["i18n"]))) {
         $this->hydrateI18nEvent($row, $event);
     }
     return $event;
 }