src/Sulu/Bundle/ContactBundle/Contact/AbstractContactManager.php
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;
    }
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;
    }
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 ; }
Process all phones from request.

@param $contact The contact on which is processed
@param $phones

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