src/Sulu/Bundle/ContactBundle/Contact/AbstractContactManager.php
public function processCategories($contact, $categoryIds)
    {
        $contact->getCategories()->clear();

        if (!$categoryIds) {
            return true;
        }

        foreach ($categoryIds as $categoryId) {
            $category = $this->em->getRepository(self::$categoryEntityName)->find($categoryId);

            if (!$category) {
                throw new EntityNotFoundException(self::$categoryEntityName, $categoryId);
            }

            $contact->addCategory($category);
        }

        return true;
    }
public function processCategories($contact, $categoryIds)
    {
        $contact->getCategories()->clear();

        if (!$categoryIds) {
            return true;
        }

        foreach ($categoryIds as $categoryId) {
            $category = $this->em->getRepository(self::$categoryEntityName)->find($categoryId);

            if (!$category) {
                throw new EntityNotFoundException(self::$categoryEntityName, $categoryId);
            }

            $contact->addCategory($category);
        }

        return true;
    }
public function processCategories ( $ contact , $ categoryIds ) { $ contact -> getCategories ( ) -> clear ( ) ; if ( ! $ categoryIds ) { return true ; } foreach ( $ categoryIds as $ categoryId ) { $ category = $ this -> em -> getRepository ( self :: $ categoryEntityName ) -> find ( $ categoryId ) ; if ( ! $ category ) { throw new EntityNotFoundException ( self :: $ categoryEntityName , $ categoryId ) ; } $ contact -> addCategory ( $ category ) ; } return true ; }
Process all categories of request.

@param $contact - the contact which is processed
@param $categories

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