Exemplo n.º 1
0
 /**
  * @param array $data
  * @return Struct\Country
  */
 public function hydrateCountry(array $data)
 {
     $country = new Struct\Country();
     $translation = $this->getTranslation($data, '__country_translation', '__country_translation_fallback', $data['__country_id'], $this->translationCountryFields);
     $data = array_merge($data, $translation);
     $country->setId((int) $data['__country_id']);
     $country->setName($data['__country_countryname']);
     if (isset($data['__country_countryiso'])) {
         $country->setIso($data['__country_countryiso']);
     }
     if (isset($data['__country_iso3'])) {
         $country->setIso3($data['__country_iso3']);
     }
     if (isset($data['__country_notice'])) {
         $country->setDescription($data['__country_notice']);
     }
     if (isset($data['__country_countryen'])) {
         $country->setEn($data['__country_countryen']);
     }
     if (isset($data['__country_display_state_in_registration'])) {
         $country->setDisplayStateSelection((bool) $data['__country_display_state_in_registration']);
     }
     if (isset($data['__country_force_state_in_registration'])) {
         $country->setRequiresStateSelection((bool) $data['__country_force_state_in_registration']);
     }
     if (isset($data['__country_shippingfree'])) {
         $country->setShippingFree((bool) $data['__country_shippingfree']);
     }
     if (isset($data['__country_taxfree'])) {
         $country->setTaxFree((bool) $data['__country_taxfree']);
     }
     if (isset($data['__country_taxfree_ustid'])) {
         $country->setTaxFreeForVatId((bool) $data['__country_taxfree_ustid']);
     }
     if (isset($data['__country_taxfree_ustid_checked'])) {
         $country->setVatIdCheck((bool) $data['__country_taxfree_ustid_checked']);
     }
     if ($data['__countryAttribute_id'] !== null) {
         $attribute = $this->attributeHydrator->hydrate($this->extractFields('__countryAttribute_', $data));
         $country->addAttribute('core', $attribute);
     }
     return $country;
 }