Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function setProvince(ProvinceInterface $province = null)
 {
     if (null === $this->country) {
         throw new \BadMethodCallException('Cannot define province on address without assigned country');
     }
     if (null !== $province && !$this->country->hasProvince($province)) {
         throw new \InvalidArgumentException(sprintf('Cannot set province "%s", because it does not belong to country "%s"', $province->getName(), $this->country->getName()));
     }
     $this->province = $province;
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function getName()
 {
     return $this->country->getName();
 }