Ejemplo n.º 1
0
 public function getRegion()
 {
     if (!$this->getCountry()->getId()) {
         return NULL;
     }
     if (is_null($this->region)) {
         $countryRegions = $this->getCountry()->getRegionCollection();
         $countryRegions->getSelect()->where('code = ? OR default_name = ?', $this->getState());
         $this->region = $countryRegions->getFirstItem();
         if ($this->isRegionValidationRequired() && !$this->region->getId()) {
             throw new \Ess\M2ePro\Model\Exception(sprintf('State/Region "%s" in the shipping address is invalid.', $this->getState()));
         }
     }
     return $this->region;
 }