src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
private function addContactRelation(array $data, $key, $addCallback)
    {
        $contact = null;
        if (array_key_exists($key, $data) &&
            is_array($data[$key]) &&
            array_key_exists('id', $data[$key])
        ) {
            /** @var Contact $contact */
            $contactId = $data[$key]['id'];
            $contact = $this->em->getRepository(static::$contactEntityName)->find($contactId);
            if (!$contact) {
                throw new OrderDependencyNotFoundException(static::$contactEntityName, $contactId);
            }
            $addCallback($contact);
        }

        return $contact;
    }
private function addContactRelation(array $data, $key, $addCallback)
    {
        $contact = null;
        if (array_key_exists($key, $data) &&
            is_array($data[$key]) &&
            array_key_exists('id', $data[$key])
        ) {
            /** @var Contact $contact */
            $contactId = $data[$key]['id'];
            $contact = $this->em->getRepository(static::$contactEntityName)->find($contactId);
            if (!$contact) {
                throw new OrderDependencyNotFoundException(static::$contactEntityName, $contactId);
            }
            $addCallback($contact);
        }

        return $contact;
    }
private function addContactRelation ( array $ data , $ key , $ addCallback ) { $ contact = null ; if ( array_key_exists ( $ key , $ data ) && is_array ( $ data [ $ key ] ) && array_key_exists ( 'id' , $ data [ $ key ] ) ) { /** @var Contact $contact */ $ contactId = $ data [ $ key ] [ 'id' ] ; $ contact = $ this -> em -> getRepository ( static :: $ contactEntityName ) -> find ( $ contactId ) ; if ( ! $ contact ) { throw new OrderDependencyNotFoundException ( static :: $ contactEntityName , $ contactId ) ; } $ addCallback ( $ contact ) ; } return $ contact ; }
Searches for contact in specified data and calls callback function

@param array $data
@param string $key
@param callable $addCallback

@throws Exception\MissingOrderAttributeException
@throws Exception\OrderDependencyNotFoundException

@return Contact|null
Searches for contact in specified data and calls callback function