Programming Language PHP

Namespace Oro\Bundle\ContactBundle\Entity

Class Contact

Method/Function getAccounts

Total Examples 1

1 code examples of PHP Oro\Bundle\ContactBundle\Entity\Contact::getAccounts extracted from open source projects

Was this example useful?
0
                                                    protected function processMultipleRelations(Contact $entity)
    {
        // update groups
        foreach ($entity->getGroups() as $group) {
            $entity->removeGroup($group);
            if ($group = $this->findExistingEntity($group)) {
                $entity->addGroup($group);
            }
        }

        // clear accounts
        foreach ($entity->getAccounts() as $account) {
            $entity->removeAccount($account);
        }

        // update addresses
        /** @var ContactAddress $contactAddress */
        foreach ($entity->getAddresses() as $contactAddress) {
            // update address types
            foreach ($contactAddress->getTypes() as $addressType) {
                $contactAddress->removeType($addressType);
                $existingAddressType = $this->findExistingEntity($addressType);
                if ($existingAddressType) {
                    $contactAddress->addType($existingAddressType);
                }
            }
        }
    }