Inheritance: extends Sulu\Component\Persistence\Repository\ORM\EntityRepository, implements Sulu\Component\SmartContent\Orm\DataProviderRepositoryInterface, use trait Sulu\Component\SmartContent\Orm\DataProviderRepositoryTrait
Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * {@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);
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 /**
  * Get contact entity name.
  *
  * @return string
  */
 public function getContactEntityName()
 {
     return $this->contactRepository->getClassName();
 }