/** * Sets this contact's state by state ISO code. * * @param string $iso_code * @throws \Exception //if ISO code does not exist * @throws \Exception //if ISO code is not a non-empty * string */ public function setStateIsoCode($iso_code) { $iso_code = \Altumo\Validation\Strings::assertNonEmptyString($iso_code); $iso_code = strtoupper($iso_code); $state = \StatePeer::retrieveByCode($iso_code); if (!$state) { throw new \Exception('Unknown ISO code: ' . $iso_code); } $this->setState($state); }