Добрый день .
Подскажите как можно получить список всех 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;
Подскажите как можно получить список всех 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;
Comment