/** * Remove a Lead's DNC entry based on channel. * * @param Lead $lead * @param string $channel * * @return boolean */ public function removeDncForLead(Lead $lead, $channel) { /** @var DoNotContact $dnc */ foreach ($lead->getDoNotContact() as $dnc) { if ($dnc->getChannel() === $channel) { $lead->removeDoNotContactEntry($dnc); $this->getRepository()->saveEntity($lead); return true; } } return false; }