Sulu\Bundle\ContactBundle\Contact\AbstractContactManager::addNewContactRelations PHP Méthode

addNewContactRelations() public méthode

adds new relations.
public addNewContactRelations ( Contact $contact, array $data )
$contact Sulu\Bundle\ContactBundle\Entity\Contact
$data array
    public function addNewContactRelations($contact, $data)
    {
        // urls
        $urls = $this->getProperty($data, 'urls');
        if (!empty($urls)) {
            foreach ($urls as $urlData) {
                $this->addUrl($contact, $urlData);
            }
            $this->setMainUrl($contact);
        }
        //faxes
        $faxes = $this->getProperty($data, 'faxes');
        if (!empty($faxes)) {
            foreach ($faxes as $faxData) {
                $this->addFax($contact, $faxData);
            }
            $this->setMainFax($contact);
        }
        // emails
        $emails = $this->getProperty($data, 'emails');
        if (!empty($emails)) {
            foreach ($emails as $emailData) {
                $this->addEmail($contact, $emailData);
            }
            $this->setMainEmail($contact);
        }
        // phones
        $phones = $this->getProperty($data, 'phones');
        if (!empty($phones)) {
            foreach ($phones as $phoneData) {
                $this->addPhone($contact, $phoneData);
            }
            $this->setMainPhone($contact);
        }
        // addresses
        $addresses = $this->getProperty($data, 'addresses');
        if (!empty($addresses)) {
            foreach ($addresses as $addressData) {
                $address = $this->createAddress($addressData, $isMain);
                $this->addAddress($contact, $address, $isMain);
            }
        }
        // set main address (if it was not set yet)
        $this->setMainForCollection($this->getAddressRelations($contact));
        // notes
        $notes = $this->getProperty($data, 'notes');
        if (!empty($notes)) {
            foreach ($notes as $noteData) {
                $this->addNote($contact, $noteData);
            }
        }
        // handle tags
        $tags = $this->getProperty($data, 'tags');
        if (!empty($tags)) {
            foreach ($tags as $tag) {
                $this->addTag($contact, $tag);
            }
        }
        // process details
        if ($this->getProperty($data, 'bankAccounts') !== null) {
            $this->processBankAccounts($contact, $this->getProperty($data, 'bankAccounts', []));
        }
    }