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

processPhones() public méthode

Process all phones from request.
public processPhones ( $contact, $phones ) : boolean
$contact The contact on which is processed
$phones
Résultat boolean True if the processing was successful, otherwise false
    public function processPhones($contact, $phones)
    {
        $get = function ($phone) {
            return $phone->getId();
        };
        $delete = function ($phone) use($contact) {
            return $contact->removePhone($phone);
        };
        $update = function ($phone, $matchedEntry) {
            return $this->updatePhone($phone, $matchedEntry);
        };
        $add = function ($phone) use($contact) {
            return $this->addPhone($contact, $phone);
        };
        $entities = $contact->getPhones();
        $result = $this->processSubEntities($entities, $phones, $get, $add, $update, $delete);
        $this->resetIndexOfSubentites($entities);
        // check main
        $this->setMainPhone($contact);
        return $result;
    }