/**
  * @param object|null $owner
  *
  * @return RecipientEntity|null
  */
 protected function createRecipientEntity($owner = null)
 {
     if (!$owner) {
         return null;
     }
     $metadata = $this->registry->getManager()->getClassMetadata(ClassUtils::getClass($owner));
     return $this->emailRecipientsHelper->createRecipientEntity($owner, $metadata);
 }
 /**
  * @param array $emails
  * @param object $object
  * @param ClassMetadata $objectMetadata
  *
  * @return Recipient[]
  */
 protected function createRecipientsFromEmails(array $emails, $object, ClassMetadata $objectMetadata)
 {
     $recipientEntity = $this->emailRecipientsHelper->createRecipientEntity($object, $objectMetadata);
     $recipients = [];
     foreach ($emails as $email => $name) {
         $recipient = new Recipient($email, $name, $recipientEntity);
         $recipients[$recipient->getIdentifier()] = $recipient;
     }
     return $recipients;
 }