src/Sulu/Bundle/ContactBundle/Contact/AbstractContactManager.php
public function processEmails($contact, $emails)
    {
        $get = function($email) {
            /* @var Email $email */

            return $email->getId();
        };

        $delete = function($email) use ($contact) {
            return $contact->removeEmail($email);
        };

        $update = function($email, $matchedEntry) {
            return $this->updateEmail($email, $matchedEntry);
        };

        $add = function($email) use ($contact) {
            return $this->addEmail($contact, $email);
        };

        $entities = $contact->getEmails();

        $result = $this->processSubEntities(
            $entities,
            $emails,
            $get,
            $add,
            $update,
            $delete
        );

        $this->resetIndexOfSubentites($entities);

        // check main
        $this->setMainEmail($contact);

        return $result;
    }
public function processEmails($contact, $emails)
    {
        $get = function($email) {
            /* @var Email $email */

            return $email->getId();
        };

        $delete = function($email) use ($contact) {
            return $contact->removeEmail($email);
        };

        $update = function($email, $matchedEntry) {
            return $this->updateEmail($email, $matchedEntry);
        };

        $add = function($email) use ($contact) {
            return $this->addEmail($contact, $email);
        };

        $entities = $contact->getEmails();

        $result = $this->processSubEntities(
            $entities,
            $emails,
            $get,
            $add,
            $update,
            $delete
        );

        $this->resetIndexOfSubentites($entities);

        // check main
        $this->setMainEmail($contact);

        return $result;
    }
public function processEmails ( $ contact , $ emails ) { $ get = function ( $ email ) { /* @var Email $email */ return $ email -> getId ( ) ; } ; $ delete = function ( $ email ) use ( $ contact ) { return $ contact -> removeEmail ( $ email ) ; } ; $ update = function ( $ email , $ matchedEntry ) { return $ this -> updateEmail ( $ email , $ matchedEntry ) ; } ; $ add = function ( $ email ) use ( $ contact ) { return $ this -> addEmail ( $ contact , $ email ) ; } ; $ entities = $ contact -> getEmails ( ) ; $ result = $ this -> processSubEntities ( $ entities , $ emails , $ get , $ add , $ update , $ delete ) ; $ this -> resetIndexOfSubentites ( $ entities ) ; // check main $ this -> setMainEmail ( $ contact ) ; return $ result ; }
Process all emails from request.

@param $contact The contact on which is worked
@param $emails

@return bool True if the processing was successful, otherwise false
Process all emails from request .