/** * resolves user id to user data. * * @param int $id id to resolve * * @return Contact */ public function resolveContactFunction($id) { if ($this->cache->contains($id)) { return $this->cache->fetch($id); } $contact = $this->contactRepository->find($id); if ($contact === null) { return; } $this->cache->save($id, $contact); return $contact; }
/** * {@inheritdoc} */ public function findByFilters($filters, $page, $pageSize, $limit, $locale, $options = []) { $entities = $this->contactRepository->findByFilters($filters, $page, $pageSize, $limit, $locale, $options); return array_map(function ($contact) use($locale) { return $this->getApiObject($contact, $locale); }, $entities); }
/** * Returns contacts by account id. * * @param $id * @param $locale * @param bool $onlyFetchMainAccounts * * @return array|null */ public function findContactsByAccountId($id, $locale, $onlyFetchMainAccounts = false) { $contactsEntities = $this->contactRepository->findByAccountId($id, null, false, $onlyFetchMainAccounts); if (!empty($contactsEntities)) { $contacts = []; foreach ($contactsEntities as $contact) { $contacts[] = new Contact($contact, $locale, $this->tagManager); } return $contacts; } return; }
/** * Get contact entity name. * * @return string */ public function getContactEntityName() { return $this->contactRepository->getClassName(); }