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

processEmails() public méthode

Process all emails from request.
public processEmails ( $contact, $emails ) : boolean
$contact The contact on which is worked
$emails
Résultat boolean True if the processing was successful, otherwise false
    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;
    }