Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * @param $id
  * @param $locale
  *
  * @throws EntityNotFoundException
  *
  * @return mixed
  */
 public function getById($id, $locale)
 {
     $contact = $this->contactRepository->find($id);
     if (!$contact) {
         throw new EntityNotFoundException($this->contactRepository->getClassName(), $id);
     }
     return $this->getApiObject($contact, $locale);
 }
Example #3
0
 /**
  * @param $id
  * @param $locale
  *
  * @throws EntityNotFoundException
  *
  * @return mixed
  */
 public function getById($id, $locale)
 {
     $contact = $this->contactRepository->find($id);
     if (!$contact) {
         return;
     }
     return new ContactApi($contact, $locale, $this->tagManager);
 }