Получить список всех email в сущности

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • i.nagaitsev@medtour.help
    Junior Member
    • Apr 2021
    • 8

    Получить список всех email в сущности

    Добрый день .
    Подскажите как можно получить список всех email в сущности , пожалуйста.
    Вот как получаю главный email в сущности :
    $accounts = $this->entityManager
    ->getRepository('Lead')
    ->getRelation($entity, 'accounts')
    ->find();
    $existingIdListAccounts = []; // array id Accounts
    if ($accounts) {
    foreach ($accounts as $value) {
    $existingIdListAccounts[] = $value->id;
    }
    }
    $main_email_partner = [];
    foreach ((array)$existingIdListAccounts as $key => $value) {
    $ListAccounts = $this->entityManager->getRepository('Account')
    ->select(['id', 'name', 'emailAddress'])
    ->order('createdAt')
    ->where([
    'id' => $value
    ])->find();
    $emailAddress = [];
    $ac_email = new \stdClass();
    foreach ($ListAccounts as $value1) {
    $file[] = $value1->id;
    $id = $value1->id;
    $ac_email->$id = $value1->get('emailAddress');
    }
    $main_email_partner[] = (array)$ac_email;
    }
    $main_email_partner1 = [];
    foreach ($main_email_partner as $value) {
    foreach ($value as $key => $value1) {
    $main_email_partner1[] = $value1;
    }
    }

    $lead['email_partner'] = (array)$main_email_partner1;
  • VikinGDM
    Member
    • Feb 2019
    • 92

    #2
    День добрый, если еще актуально - пробуйте 'emailAddressData', а не 'emailAddress'

    Comment

    Working...