public setMainEmail ( |
||
$entity |
public function setMainEmail($entity)
{
// set main to first entry or to null
if ($entity->getEmails()->isEmpty()) {
$entity->setMainEmail(null);
} else {
$entity->setMainEmail($entity->getEmails()->first()->getEmail());
}
}