src/Sulu/Bundle/ContactBundle/Contact/AbstractContactManager.php
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;
    }
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;
    }
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 ; }
Adds a new tag to the given contact.

@param $contact
@param $data

@return bool

@throws EntityNotFoundException
@throws EntityIdAlreadySetException
Adds a new tag to the given contact .