@@ 1094-1102 (lines=9) @@ | ||
1091 | */ |
|
1092 | public function addEmail(ContactEmail $email) |
|
1093 | { |
|
1094 | if (!$this->emails->contains($email)) { |
|
1095 | //don't allow more than one primary email |
|
1096 | if ($email->isPrimary() && $this->getPrimaryEmail()) { |
|
1097 | $email->setPrimary(false); |
|
1098 | } |
|
1099 | ||
1100 | $this->emails->add($email); |
|
1101 | $email->setOwner($this); |
|
1102 | } |
|
1103 | ||
1104 | return $this; |
|
1105 | } |
|
@@ 1221-1229 (lines=9) @@ | ||
1218 | */ |
|
1219 | public function addPhone(ContactPhone $phone) |
|
1220 | { |
|
1221 | if (!$this->phones->contains($phone)) { |
|
1222 | //don't allow more than one primary phone |
|
1223 | if ($phone->isPrimary() && $this->getPrimaryPhone()) { |
|
1224 | $phone->setPrimary(false); |
|
1225 | } |
|
1226 | ||
1227 | $this->phones->add($phone); |
|
1228 | $phone->setOwner($this); |
|
1229 | } |
|
1230 | ||
1231 | return $this; |
|
1232 | } |
|
@@ 1316-1324 (lines=9) @@ | ||
1313 | public function addAddress(AbstractAddress $address) |
|
1314 | { |
|
1315 | /** @var ContactAddress $address */ |
|
1316 | if (!$this->addresses->contains($address)) { |
|
1317 | //don't allow more than one primary address |
|
1318 | if ($address->isPrimary() && $this->getPrimaryAddress()) { |
|
1319 | $address->setPrimary(false); |
|
1320 | } |
|
1321 | ||
1322 | $this->addresses->add($address); |
|
1323 | $address->setOwner($this); |
|
1324 | } |
|
1325 | ||
1326 | return $this; |
|
1327 | } |