public function export(Service $entity) { $contacts = array_map(function (Contact $contact) { return $this->contactBridge->export($contact); }, $entity->getContacts()); return array('id' => (string) $entity->getId(), 'enabled' => $entity->isEnabled(), 'name' => $entity->getName(), 'host' => $this->hostBridge->export($entity->getHost()), 'contacts' => $contacts); }