protected function addUrl($contact, $data)
{
$success = true;
$urlType = $this->em->getRepository(self::$urlTypeEntityName)->find($data['urlType']['id']);
if (isset($data['id'])) {
throw new EntityIdAlreadySetException(self::$urlEntityName, $data['id']);
} elseif (!$urlType) {
throw new EntityNotFoundException(self::$urlTypeEntityName, $data['urlType']['id']);
} else {
$url = new Url();
$url->setUrl($data['url']);
$url->setUrlType($urlType);
$this->em->persist($url);
$contact->addUrl($url);
}
return $success;
}