I want to get each Lead that has a specific phone number associated (primary or secondary). I am confused on the correct way to get them.
My code below returns only one Lead, but I manually confirmed there is more than one with the same phone number.
Please advise! Thanks
My code below returns only one Lead, but I manually confirmed there is more than one with the same phone number.
Code:
$num = '1234567890';
$r = $entityManager->getRepository('Lead');
$f = $r->join('phone_numbers')->where(['phoneNumbers.numeric' => $num])->find();
echo($f->count()." Leads with number $num found...".PHP_EOL);
foreach($f as $L){
echo($L->id).PHP_EOL);
}

Comment