/** * Check possibility of reattach * * @param EmailAttachment $emailAttachment * @param object $targetEntity * @param string $targetClass * * @return bool */ public function canReAttach($emailAttachment, $targetEntity) { if ($this->emailAttachmentManager->validateEmailAttachmentForTargetClass($emailAttachment, ClassUtils::getRealClass($targetEntity))->count() > 0 || $this->emailAttachmentManager->isAttached($emailAttachment, $targetEntity)) { return false; } else { return true; } }