*/ trait ContactPointType { /** * * @param string $type * @return \AppBundle\Entity\Core\ContactPoint or null */ public function getContactPointForType($type) { $contactPointEnum = new ContactPointTypeEnum($type); if ($this->getContactPoint()) { foreach($this->getContactPoint() as $contactPoint) { if ($contactPointEnum->getValue() === $contactPoint->getContactType()) { return $contactPoint; } } } return null; } /** * * @return \AppBundle\Entity\Core\ContactPoint or null */ public function getContactPointPrincipal() { return $this->getContactPointForType(ContactPointTypeEnum::PRINCIPAL); } } ?>